计算网站上文件下载量的最佳方法 [英] Best way to count file downloads on a website

查看:84
本文介绍了计算网站上文件下载量的最佳方法的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

对于这个问题,找到一个简单而简明的答案是多么困难,令人惊讶:


  1. 我有一个文件foo.zip ,在我的网站上

  2. 如何查找有多少人访问了此文件?

  3. 如有必要,我可以使用Tomcat调用

更新:如果您建议编写脚本,您能指出一个不错的脚本吗?

解决方案

或者,如果不需要实时数据,也可以解析日志文件。

  grep foo.zip /path/to/access.log | grep 200 | wc -l 

回复评论:



日志文件中还包含已下载的字节,但正如其他人指出的那样,如果用户在客户端取消下载,则这可能无法反映正确的计数。

It's surprising how difficult it is to find a simple, concise answer to this question:

  1. I have a file, foo.zip, on my website
  2. What can I do to find out how many people have accessed this file?
  3. I could use Tomcat calls if necessary

Update: If you suggest writing a script, can you point me to a decent one?

解决方案

Or you could parse the log file if you don't need the data in realtime.

grep foo.zip /path/to/access.log | grep 200 | wc -l

In reply to comment:

The log file also contains bytes downloaded, but as someone else pointed out, this may not reflect the correct count if a user cancels the download on the client side.

这篇关于计算网站上文件下载量的最佳方法的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆