![]() Since, in my opinion, it doesn't do much good to sort dotted-quad IP addresses, I suggest sorting by hit count instead. Each IP address and its count are printed on the same line, for easier interpretation of the results. The cat command reads the contents of system.log and pipes it to cut. ![]() cut is very simple to use: cat system.log cut -d -f 1-6. ![]() We completely ignore all entries other than GET / HTTP requests. While cut may see this as three separate columns, you can still extract all three of them at once, presuming the structure of your log file is consistent. I already found this useful request which gives the requests per day/minute. This solution uses an AWK's associative array to do all of the counting in one pass. Im wondering if it is possible to count unique IPs by minute on a specific day (Apache access.log) on Ubuntu. like: #!/bin/bashįor b in $(cat $a | awk ' grep -removelines-starting '66. Log is your log file, and iprange is your file containing the ipranges. SetEnvIf RemoteAddr '66.249.' dontlog entry in my nf file but it didnt seem to work. So you can easily access all this information by simply opening /home/log.txt file. 0 10 sudo /home/extractip.sh >/home/log.txt 2>&1. Why not put it in a script, and have separate commands on separate lines. i have a 6gb httpd log file and i want to remove lines beginging in 66.249 (ip block of googlebot) i did have a. Add the following line to run the above shell script everyday at 10.a.m and send the output to /home/iplog.txt. Well, your code is hardly a bash solution, is it? You use sort, awk, grep, and echo.Īdditionally, your code is dumped on a single line, and it makes it hard to read.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |