1

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?

2
  • What should happen to the log entries if the daemon isn't listening? Can they get lost, or should something (what) buffer them? Commented Mar 29, 2011 at 22:09
  • @Gilles: I already send them to log files with another syslog entry ... just no sense in doubling them. Commented Mar 29, 2011 at 22:10

1 Answer 1

2

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.

4
  • 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... Commented Mar 29, 2011 at 22:47
  • @KyleBrandt: Now I'm confused: wouldn't netcat completely insulate your daemon from UDP? Commented Mar 29, 2011 at 23:18
  • @Gillies: Ya, but cleaner just to put what netcat does in python itself if I can I think Commented Mar 29, 2011 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. Commented Mar 30, 2011 at 1:55

You must log in to answer this question.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.