> ## Content Index
> Fetch the complete content index at: https://kudithipudi.org/llms.txt
> Use this file to discover other available public pages before exploring further.

# HOW TO : Sort Apache Web Logs for hits by Unique IP Addresses
- URL: https://kudithipudi.org/how-to-sort-apache-web-logs-for-hits-by-unique-ip-addresses/
- Published: 2012-02-29T07:35:56.000Z
- Updated: 2012-02-29T07:35:56.000Z
- Description: Say you want to find out how many hits you are getting t0 a specific page from a particular source IP, you can use this...
- Author: admin
- Tags: HOWTO, Linux, Technology, Uncategorized, Web, #wp, #wp-post, #Import 2026-08-23 02:32

Say you want to find out how many hits you are getting t0 a specific page from a particular source IP, you can use this quick collection of [Linux](http://en.wikipedia.org/wiki/Linux?ref=kudithipudi.org) tools to get this data

```
grep -i "URL_TO_CHECK" PATH_TO_APACHE_ACCESS_LOG | cut -d’ ‘ -f 1 -| sort |uniq -c | sort -rn > ~/ip_report.txt
```

You are using

- [grep](http://www.gnu.org/software/grep/?ref=kudithipudi.org) to filter the string of the page you want the report on
- [cut](http://www.gnu.org/software/coreutils/manual/html%5Fnode/cut-invocation.html?ref=kudithipudi.org) to get the IP address from the log file
- [sort](http://www.gnu.org/software/coreutils/manual/html%5Fnode/sort-invocation.html?ref=kudithipudi.org) and [uniq](http://www.gnu.org/software/coreutils/manual/html%5Fnode/uniq-invocation.html?ref=kudithipudi.org) to sort the unique IP addresses
- and finally sort -rn to sort the data in descending order

Example :

```
grep -i "GET /" /opt/apache/logs/access_log | cut -d’ ‘ -f 1 -| sort |uniq -c | sort -rn > ~/ip_report.txt
```

gets you the report of hits to the index page.