I have created this script
It produces this output
This is the log file it comes from
(edited to show whole line - was a single long line)
I need to be able to specify the date and time range in the script. For example, I need to know what IP's were active 02:20 -02:30 June 30th, 2015.
Please help me to figure out the script that will permit this range of times reporting.
Thanks,
Randal
Code:
#!/bin/sh
FILES=/data/log/access_*.log
for f in $FILES
do
echo "Processing $f file"
cat $f | awk '{print $1}' | sort | uniq -c | sort -n | tail
done
Code:
Processing /data/log/access_abc.log file
114 1.1.1.1
167 2.2.2.2
2258 3.3.3.3
Processing /data/log/access_def.log file
102 1.1.1.1
102 2.2.2.2
2040 3.3.3.3
Code:
1.1.1.1 - - [01/Jul/2015:10:59:29 -0400]
"GET /themes/warehouse/img/arrow_right_2.png HTTP/1.1" 200 149
"http://www.abcd.com/content/152-Tea_Tree_Oil_Uses_sp_153"
"Mozilla/5.0 (iPad; CPU OS 8_3 like Mac OS X) AppleWebKit/600.1.4 (KHTML, like Gecko) Version/8.0 Mobile/12F69 Safari/600.1.4"
I need to be able to specify the date and time range in the script. For example, I need to know what IP's were active 02:20 -02:30 June 30th, 2015.
Please help me to figure out the script that will permit this range of times reporting.
Thanks,
Randal
Moderator's Comments: | ||
|