When using the ''program()'' destination driver, the script processing the messages exits after processing the first message.
Read log messages from stdin. Instead of fetching a single line and exiting, keep reading the input. For example in Perl this can be accomplished as follows:
Please note, that syslog-ng automatically restarts applications started by ''program()'', which can cause unnecessary load on the machine if happens too often.