grep & messy logs
Well I finally got tired of fussing through large and disorganized webserver logs for my routine security sweeps.
I recall how when I ran linux that I could use such a powerful utility called GREP, which honestly is a must have for anyone who handles logs or text documents.
Knowing that Cygwin bridges the gap between Linux and Windows I decided to install cygwin (again) and see what all I require to run GREP under WinXP.
After tweaking some settings to GREP and creating batch file to handle the logs I am quite satisfied.
# of Lines in Original Logs: 7,269
# of Lines in Cleaned Logs: 4,273
# of Lines in 404 Logs: 27
Final Tally
# of Lines from logfiles that are Kept: 4,300
# of Lines from logfiles that went to the Trash Bin: 2,969
Now I can easily see all the failed urls (404’s) from one log file, and see all the other url requests from another log file. This little batch has organized my logs and removed unecessary information.