Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I want to stream the contents of an error log (/log/spo.error) as it's written, but pipe the stream through sed before I see it. How can I do that?

share|improve this question
Tried tail? Like tail -f /log/spo.error | sed 's/whatever/you want/'. –  manatwork Sep 12 '11 at 14:12
Use a fifo/named pipe and read from it? –  maxmackie Sep 12 '11 at 14:40
How do I set up the log file to be a fifo? Also how do I pipe one fifo through a SED or AWK processes? –  James Andino Sep 12 '11 at 14:48
See my answer below for information about piping syslog. –  maxmackie Sep 12 '11 at 15:00

2 Answers 2

If you're using syslog (classical syslog), in your /etc/syslog.conf file add this line:

*.*        /tmp/fifo

where /tmp/fifo is a pipe you create using mknod p /tmp/fifo.

Restart your syslog service so that it reads your new configuration and now all logs will get dumped into the pipe. Then you can tail the pipe if you'd like or do whatever to read it (just keep race conditions in mind).

share|improve this answer
Ok, what if its not a log that I want to pipe. Say I just have a text file thats being appended to and I want to read it as it gets appended is syslog still the tool I want to use? –  James Andino Sep 13 '11 at 12:47
If it's just regular text, I would do what @manatwork suggested in the comments. tail -f /file will show you the appends to that file in real time. You can then use sed to parse it. –  maxmackie Sep 13 '11 at 14:53
up vote 0 down vote accepted

tail -f was the way to go ty. I will ask more about FIFOs later ;)

share|improve this answer

Your Answer


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.