aTech Log Server
This simple service will run a centralised log server which can receive messages over UDP from applications and store them in a file.
- You must have Ruby install on your host (1.8.7 or 1.9.3 are currently supported)
- An internet connection
Installing & running the log server
git clone https://github.com/atech/log-server.git /opt/log-server ln -s /opt/log-server/upstart.conf /etc/init/log-server.conf start log-server
All logs by default are stored in
Sending a log message to the server
The following code outlines how to send a message to the log server. You should replace
the IP address of your installed log server.
app_name = 'sirportly' log_name = 'workers' message = "Hello there! This is a test of my log server..." socket = UDPSocket.new data = [app_name.bytesize, app_name, log_name.bytesize, log_name, message.bytesize, message, 0].pack('nA*nA*nA*n') socket.send(data, 0, '184.108.40.206', 4455)
This works well with our log server IO class which can easily be used with loggers.
logger = Logger.new(Atech::NetworkLogIO.new(:host => '220.127.116.11', :app_name => 'demo', :log_name => 'app'))