Posts: 194
Threads: 25
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Jul 2014
Reputation:
0
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
Posts: 580
Threads: 75
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Feb 2013
Reputation:
0
This is very useful, thank you peter.
Posts: 768
Threads: 40
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: May 2011
Reputation:
0
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
Posts: 77
Threads: 8
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Mar 2012
Reputation:
0
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.
Posts: 194
Threads: 25
Thanks Received:
0 in 0 posts
Thanks Given: 0
Joined: Jul 2014
Reputation:
0
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]