undefined
undefined

Reputation: 2101

Apache - Find the number of requests for a file

So here's the problem: I want to find out how many times a certain file(or files) has been viewed(or downloaded).
Can I get this kind of info from the apache logs, and if yes how?

Upvotes: 0

Views: 330

Answers (1)

Karthikeyan
Karthikeyan

Reputation: 990

With apache Access logs you could be able to identify whether a particular resource accessed or not along with response code. You will have to count number of such accesses which resulted in success response. For this, you may have to grep all the previous logs. I don't think there is straight forward way for this. If your logs are huge, you could consider some map and reduce framework to achieve this.

Another option is to have your app server delivers the resource using some controller, and persist the count in database, which is generally inefficient.

Upvotes: 1

Related Questions