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.

Our analytics software monitors the HTML pages that we're serving quite nicely (through embedded javascript) but we have a few image files that are not included in these reports as they're not attached to any HTML. Knowing the file's name/path, I'm looking for quick (and dirty if necessary) way to identify how many times a given image was served by Apache on each Day (or hour?).

share|improve this question

2 Answers 2

up vote 1 down vote accepted

You will need to look at your particular log format, but as an example:

grep '/foo.jpg' /var/log/access.log | grep '11/May' | wc -l
share|improve this answer
    
i'm using: grep -c "/images/foo.jpg" /var/log/apache2/access_log and it gives me the count –  Meltemi May 13 '10 at 15:57

Quick and dirty: grep for the image in the access log.

Number of times in a day = number of lines containing that pattern (assuming you roll your logs daily).
Number of times in an hour/minute/morning/afternoon/etc. gets a bit more complex but is still easily accomplished with some creative perl or shell scripting (the particulars of which depend on your log format)

share|improve this answer

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.