Kinda server noob. Is there a simple command to run on server access logs to track downloads of a particular file? Running Ubuntu 10.04.
Asked
Active
Viewed 472 times
2 Answers
1
$ grep "/path/to/file" /var/log/httpd/access.log | wc -l
That looks for entries in your access log for '/path/to/file' and gives you a count of those lines. Run it against more logs for more days.

Bill Weiss
- 10,979
- 3
- 38
- 66
0
As Bill Weiss suggested, though older files are compressed, run zgrep
on them. You can also use tail
to see requested files in real time:
tail -f /var/log/httpd/access.log | grep "/path/to/file"
or to monitor multiple files:
tail -f /var/log/httpd/access.log | grep -E "(/path/to/file|/path/to/other/file)"

Hubert Kario
- 6,361
- 6
- 36
- 65