[Shell] filtering logs
#1

Hi,

here a little GS log filtering shell.

Its very old but i think it can help some new guys.

I think its self explanatory.

 

[hide]

#!/bin/sh
echo "###############################################################################"

#Var
LOG1=Log140101000716
LOG2=Log140101000716
LOG3=Log140101000716
LOG4=Log140101000716
LOG5=Log140101000716
LOG6=Log140101000716
DIR=/home/Server/GameServer/LogFiles
DIR2=/home/Server/Log_GM.txt
DIR3=/home/Server/Log_Hack.txt

echo "###############################################################################"

rm Log_GM.txt
rm Log_Hack.txt
touch Log_GM.txt
touch Log_Hack.txt

find $DIR -type f -name $LOG1 | xargs grep 'GM COMMAND' >> $DIR2;
find $DIR-type f -name $LOG2 | xargs grep 'GM COMMAND' >> $DIR2;
find $DIR-type f -name $LOG3 | xargs grep 'GM COMMAND' >> $DIR2;

find $DIR-type f -name $LOG1 | xargs grep 'HACK ATTACK' >> $DIR3;
find $DIR-type f -name $LOG2 | xargs grep 'HACK ATTACK' >> $DIR3;
find $DIR-type f -name $LOG3 | xargs grep 'HACK ATTACK' >> $DIR3;

find $DIR-type f -name $LOG1 | xargs grep 'GO ZONE FAILED' >> $DIR3;
find $DIR-type f -name $LOG2 | xargs grep 'GO ZONE FAILED' >> $DIR3;
find $DIR-type f -name $LOG3 | xargs grep 'GO ZONE FAILED' >> $DIR3;

find $DIR-type f -name $LOG1 | xargs grep 'HACK MOVE' >> $DIR3;
find $DIR-type f -name $LOG2 | xargs grep 'HACK MOVE' >> $DIR3;
find $DIR-type f -name $LOG3 | xargs grep 'HACK MOVE' >> $DIR3;

clear

[/hide] 

Salute,

peter

#2
This is very useful, thank you peter.  

#3
Very nice thanks

#4

what i usually do when i want to search something in the logs, lets say i want to search for my name

 

 

fgrep Wizatek *>wizatek.txt

 

This will search for Wizatek, in file * and write the output to wizatek.txt

#5


what i usually do when i want to search something in the logs, lets say i want to search for my name

fgrep Wizatek *>wizatek.txt

This will search for Wizatek, in file * and write the output to wizatek.txt

Really love this way helped me few times already.

Easy and fast.

#6


what i usually do when i want to search something in the logs, lets say i want to search for my name

fgrep Wizatek *>wizatek.txt

This will search for Wizatek, in file * and write the output to wizatek.txt

Nice Big Grin.

#7

New Version 1.0

[hide]

#!/bin/sh
echo "###############################################################################"

#Var
LOG1=Log140101000716
LOG2=Log140101000716
LOG3=Log140101000716
LOG4=Log140101000716
LOG5=Log140101000716
LOG6=Log140101000716
DIR=/home/Server/GameServer/LogFiles
DIR2=/home/Server/Log.txt

#Searching for what? (default settings)

S1=GM COMMAND
S2=HACK ATTACK
S3=GO ZONE FAILED
S4=HACK MOVE

echo "###############################################################################"

rm Log.txt
touch Log.txt

find $DIR-type f -name $LOG1 | xargs grep '$S1' >> $DIR2;
find $DIR-type f -name $LOG2 | xargs grep '$S1' >> $DIR2;
find $DIR-type f -name $LOG3 | xargs grep '$S1' >> $DIR2;

find $DIR-type f -name $LOG1 | xargs grep '$S2' >> $DIR2;
find $DIR-type f -name $LOG2 | xargs grep '$S2' >> $DIR2;
find $DIR-type f -name $LOG3 | xargs grep '$S2' >> $DIR2;

find $DIR-type f -name $LOG1 | xargs grep '$S3' >> $DIR2;
find $DIR-type f -name $LOG2 | xargs grep '$S3' >> $DIR2;
find $DIR-type f -name $LOG3 | xargs grep '$S3' >> $DIR2;

find $DIR-type f -name $LOG1 | xargs grep '$S4' >> $DIR2;
find $DIR-type f -name $LOG2 | xargs grep '$S4' >> $DIR2;
find $DIR-type f -name $LOG3 | xargs grep '$S4' >> $DIR2;

clear

[/hide]

#8

nice

 

#9
nice

#10
nice



Forum Jump:


Users browsing this thread: 1 Guest(s)