Take the 2-minute tour ×
Server Fault is a question and answer site for professional system and network administrators. It's 100% free, no registration required.

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.

share|improve this question

2 Answers 2

up vote 3 down vote accepted
$ 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.

share|improve this answer
    
Thanks, that did exactly what I needed. –  JMC May 10 '11 at 2:48

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

share|improve this answer
1  
I'll give that a try. Thanks for the suggestion. –  JMC May 10 '11 at 2:49

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.