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

I want to have a rsyslog log its data to a fifo that a daemon creates. However, if the daemon isn't running and the fifo isn't there then rsyslog will just start writing to a file in its place.

Is there any way I can prevent this from happening?

share|improve this question
    
What should happen to the log entries if the daemon isn't listening? Can they get lost, or should something (what) buffer them? –  Gilles Mar 29 '11 at 22:09
    
@Gilles: I already send them to log files with another syslog entry ... just no sense in doubling them. –  Kyle Brandt Mar 29 '11 at 22:10

1 Answer 1

If you have any control over the way the daemon is started, tell rsyslog to log to a UDP port and pipe the data into the daemon with netcat:

nc -u -l localhost 53396 | daemon --read-from-stdin

That way, if the daemon isn't available, entries will be discarded.

If you supervise the daemon, it'll be available almost all the time anyway.

share|improve this answer
    
Was thinking about just doing that... I wrote the daemon, so I have control :-) Just have to learn how to read line by line from UDP port... –  Kyle Brandt Mar 29 '11 at 22:47
    
@KyleBrandt: Now I'm confused: wouldn't netcat completely insulate your daemon from UDP? –  Gilles Mar 29 '11 at 23:18
    
@Gillies: Ya, but cleaner just to put what netcat does in python itself if I can I think –  Kyle Brandt Mar 29 '11 at 23:28
    
That feels like an awful lot of moving parts just to write to a fifo. We tailor our syslog-ng init script to ensure the fifos we write to are in place before the service can start. –  Jeff Albert Mar 30 '11 at 1:55

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.