Configuring Log.IO server to listen just on localhost…
I could not find a built-in way of doing so, then I did need to patch some files, and will write here maybe help others and is a good way to remember myself…
The harvest.conf file has the “port” and “server” variables so you can configure the log.io-harvest server to listen on specific host/port pairs. But the log.io-server does not. The server.conf file just have a comment before the configuration of the “port” parameter, and I did think that maybe without “saying” that configure a specific host was possible, I could try to add a “host: ‘127.0.0.1’,” line and it would work… well, did not.
The solution was to find the right files to understand what exactly were the procedures called and etc. Well, I really do not have any familiarity with node.js, and I’m not proud of it. But with some find, grep, I could find the ones.
The first file is the script:
/usr/local/lib/node_modules/log.io/bin/log.io-server
After looking at the script above, I could see why adding that line on the configuration file was not working. The last three lines on that file are:
... // Instantiate & run var server = new logio.Server(HTTPServer); server.listen(config.port);
So, I changed the last one to be:
server.listen(config.port, config.host);
Did it a try, and not worked… so, looking for that functions (logio.Server and listen), I came to the file:
/usr/local/lib/node_modules/log.io/lib/server/log_server.js
And the function:
// Create HTTP Server, bind socket listen: function(port) { this.http_server.listen(port); this.io = io.listen(this.http_server); this.register(); },
I changed it to:
// Create HTTP Server, bind socket listen: function(port, host) { this.http_server.listen(port, host); this.io = io.listen(this.http_server); this.register(); },
And that’s it! Now running: “forever start /usr/local/bin/log.io-server”, and looking at the netstat’s output:
netstat -al | grep 8998 tcp 0 0 localhost:8998 *:* LISTEN
The only problem is that nginx (the reverse proxy I was planning to use), does not support the websocket yet. So, After this configuration, I will need a reverse proxy (or nginx plugin etc), to access this Log.IO server from the outside. As this Log.IO feature will be inside another application and so Log.IO cannot be listening on port 80 by itself.
Just a last bit of information, I’m using the Log.IO version v0.2.7.
Hope that helps…
peace
I am also using Nginx and a Node.js application with WebSockets. The way I am doing it, is by serving static HTML/CSS/JS files through Nginx on port 80, and then run Bouncy (https://github.com/substack/bouncy) on port 843, which then forwards connections to the WebSocket/Socket.IO Node.js server internally. It works fine for me :)
Thanks for the tips with forever ;)
Hi,
I just started using Log.io for monitoring my logs.
I have some doubts in this,
1. Can i use this to redirect my logs to some other place other than browser, i.e file or something?
2. Can i apply filter to the logs(Apache Logs) – to show only ERROR, WARN messages on the browser?