3

I'm running a Cent OS Linux apache web server, and its primary function is to serve the content in an iframe to one specific ip address. I want to see all ip addresses that have accessed the web server over the last month. Is there generally a log I can view with that information on apache web servers? I haven't installed any extra logging, it's a basic apache install. I understand that all configurations are different.

2 Answers 2

3
$ cut -d' ' -f 1 <access_log> | sort -n | uniq

Substitute the path of your apache access log, and it'll spit out a list of all IP addresses that have accessed your server.

Here's what that command is doing:

cut -d' ' -f 1 <access_log>

This will list out the first field of the access_log, using the space character as a delimiter. The output of this is then piped to:

sort -n

This, as you'd expect, does a numeric sort of the data received and then pipes the resulting list to:

uniq

Which eliminates duplicate entries on adjacent lines. Its output is displayed on-screen.

0
2

You might consider awstat to help visually "slice and dice" access trends across time as well.

0

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .