40 lines
918 B
Bash
Executable File
40 lines
918 B
Bash
Executable File
#!/bin/bash
|
|
ID=10101011
|
|
STREAM=$1
|
|
IP=10.101.0.12
|
|
PORT=34567
|
|
GREP="$2"
|
|
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 * | egrep -i "$GREP" | logger -s -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 -s -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
|
|
|
|
|