Skip to content

Watch log file and send logs to syslog

  1. #!/bin/sh
  2. append=“”;
  3. tail -F /opt/log/audit/audit.log | sed -u -e ‘s/^M//g’ -e ‘/^$/d’ -e ‘s/ *$//g’ -e ‘s/^ *//g’ -e ‘s/ +/ /g’  | while read line; do
  4.         if [ “$line” == “___” ]
  5.         then
  6.                 logger -p local0.info -t tag $append
  7.                 append=“”;
  8.         else
  9.                 append=“$append#$line”;
  10.         fi
  11. done