I am writing a script to process syslog messages passed to it. Syslog-ng takes care of filtering the messages so that only the valid ones will be sent to the program/script. The problem is, syslog will start the script only once, and will send messages to the <STDIN> of the script as they arrive.
What I need is to read <STDIN>, clear it (make it empty), and check it again later.
I know I can read <STDIN> with $line = <STDIN>; What I don't know is how to empty <STDIN> after that and how long to wait before reading it again (I don't want to read <STDIN> when syslog is in the middle of sending the message)
Any advice/pointers are appreciated.
--------------------------------
An idea is not responsible for the people who believe in it...
In reply to Need to empty STDIN by bofh_of_oz
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |