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?).
Asked
Active
Viewed 99 times
2 Answers
1
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

Kyle Brandt
- 83,619
- 74
- 305
- 448
-
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
0
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)

voretaq7
- 79,879
- 17
- 130
- 214