#!/bin/bash # # File: syslog-ng-pgsql-pipe.sh # # Take input from a FIFO and run execute it as a query for # a PostgreSQL database. # # IMPORTANT NOTE: This could potentially be a huge security hole. # You should change permissions on the FIFO accordingly. # if [ -e /tmp/pgsql.pipe ]; then while [ -e /tmp/pgsql.pipe ] do psql -q -U mydbusername syslog < /tmp/pgsql.pipe done else mkfifo /tmp/pgsql.pipe fi