Files
2024-10-14 00:08:40 +02:00

39 lines
934 B
Bash

#!/bin/bash
ID=10101011
STREAM=$1
IP=10.101.0.12
PORT=34567
GREP=$2
echo $GREP
FILTER=$3
cd /syslog
while [ 1 ]
do
echo "
Filter Device $FILTER and egrep case insensitive for $GREP
Send result to $IP:$PORT
My ID $ID and Stream $STREAM
"
echo " 2020-20-20T20:20:20+20 filter@$ID filter=\"test\" grep=\"test\" stream@$ID stream=\"test\"] testmessage" | logger --rfc5424 -n $IP --id=34567 -T -P $PORT
if [ "$FILTER" == "" ]
then
tail -f *.log | egrep -i $GREP | logger --rfc5424 -n $IP --id=34567 -T -P $PORT \
--sd-id filter@$ID \
--sd-param filter=\"none\" \
--sd-param grep=\"$GREP\" \
--sd-id stream@$ID \
--sd-param stream=\"$STREAM\"
else
tail -f * | /syslog/filter $FILTER | egrep -i $GREP | logger --rfc5424 -n $IP --id=34567 -T -P $PORT \
--sd-id filter@$ID \
--sd-param filter=\"$FILTER\" \
--sd-param grep=\"$GREP\" \
--sd-id stream@$ID \
--sd-param stream=\"$STREAM\"
fi
done