I'm trying to find a way on Red Hat Linux 9 to specify in /etc/syslog.conf a pipe command such that log entries for local4 get piped to a perl script that then inserts the log entries into a MySQL table. I've worked it out so I can use fifo's (named pipes) like the 'syslog.conf' manpage describes:
1. mkfifo /tmp/my_log_fifo
2. In /etc/syslog.conf:
local4.* |/tmp/my_log_fifo
so after restarting syslogd, log entries for local4 get written to fifo /tmp/my_log_fifo. Then I have my perl script read lines from the fifo file, and everything works fine.
But in my testing, with data *in* the fifo file, I rebooted my machine, and when it came back up, the fifo file had a size of 0, meaning the data in the fifo was lost on the reboot. I cannot afford to lose log entries in this application, so it would seem that using a fifo for this purpose would not work.
So my questions are:
1. has anyone done this successfully, and if so, how?
2. am I missing something, or is there a way to make
fifo's persistent for reboots?
2. is it possible to code a perl script such that
the perl script can be specified right in the
/etc/syslog.conf, like
local4.* |/path/to/my_perl_script.pl
in place of the fifo file?
Any help or ideas are greatly appreciated.
TIA.
Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
Read Where should I post X? if you're not absolutely sure you're posting in the right place.
Please read these before you post! —
Posts may use any of the Perl Monks Approved HTML tags:
- a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
| |
For: |
|
Use: |
| & | | & |
| < | | < |
| > | | > |
| [ | | [ |
| ] | | ] |
Link using PerlMonks shortcuts! What shortcuts can I use for linking?
See Writeup Formatting Tips and other pages linked from there for more info.