![]() |
|
[Shell] filtering logs - Printable Version +- LCKB (https://lckb.dev/forum) +-- Forum: ** OLD LCKB DATABASE ** (https://lckb.dev/forum/forumdisplay.php?fid=109) +--- Forum: Release Zone (https://lckb.dev/forum/forumdisplay.php?fid=190) +---- Forum: General Releases (https://lckb.dev/forum/forumdisplay.php?fid=127) +----- Forum: General Server Releases (https://lckb.dev/forum/forumdisplay.php?fid=212) +----- Thread: [Shell] filtering logs (/showthread.php?tid=3867) Pages:
1
2
|
- peter3301 - 07-17-2014 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 - Walletman987 - 07-17-2014 This is very useful, thank you peter. - GuX - 07-17-2014 Very nice thanks - Wizatek - 07-17-2014 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 - SnowFox - 07-18-2014 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. - peter3301 - 07-18-2014 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 .- peter3301 - 08-27-2014 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] - fonsy84 - 08-27-2014 nice - ucaff - 08-27-2014 nice - macacoloco - 08-28-2014 nice |