有点服务器noob。 是否有一个简单的命令来运行服务器访问日志来跟踪特定文件的下载? 运行Ubuntu 10.04。
$ grep "/path/to/file" /var/log/httpd/access.log | wc -l
这将查找访问日志中的“/ path / to / file”条目,并为您提供这些行的计数。 针对更多的日志运行更多的日子。
正如Bill Weiss所build议的那样,虽然较旧的文件是压缩的,但运行zgrep就可以了。 您也可以使用tail实时查看请求的文件:
tail -f /var/log/httpd/access.log | grep“/ path / to / file”
或者监视多个文件:
tail -f /var/log/httpd/access.log | grep -E“(/ path / to / file | / path / to / other / file)”