Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

I need to setup centralized remote access logging of Auto Scaling Instances. Currently I have Rsyslog / Apache2 logging working just fine, but for the new project Nginx is used and I don't see any possibility to log directly over TCP/UDP. Rsyslog can be configured to send data remotely reading local file, but my goal is to avoid local writes at all.

Can someone share the knowledge on how to configure Nginx to send messages over Network instead of local FS? Or maybe I might need to configure log rotation to scp files?

share|improve this question
add comment

2 Answers

up vote 2 down vote accepted

Create a FIFO (pipe), tell nginx to log to that, and have your syslog daemon read the FIFO and send those messages to a remote location. Both rsyslog and syslog-ng can do this.

share|improve this answer
    
In this case, why not just let Nginx to log to default file and then use Rsyslog to read and send it remotely? What is the benefit of FIFO? –  Roman Newaza Jun 26 '12 at 11:24
    
Because you said you wanted to avoid local writes. A FIFO doesn't write to disk, it's just a small chunk of memory that buffers writes. –  womble Jun 26 '12 at 11:33
    
You are right! Thanks a lot! –  Roman Newaza Jun 27 '12 at 1:24
add comment

You can try the nginx_udplog_module. It looks like it hasn't been updated in a while, but it may still work.

share|improve this answer
    
Also nice solution - thank you! –  Roman Newaza Jun 27 '12 at 1:25
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.