When creating a View, the only statistics available are total, today, and most recent. Is there a way to utilize the Access Log statistics (Number of views in last 4 weeks by example) instead?

See here for example of how to set up the typical Statisics Hits View: https://www.ostraining.com/blog/drupal/track-hits/

But instead I want only the hit count from the Access Log (Set for 3 days in the above example, mine is set for 4 weeks) so I can restrict the counter to a larger time period than "today", but shorter than "total".

2 Answers 2


Maybe the visitors module might be a valid alternative to consider? Refer to its community docu for some more details.

Be aware: I'm the new maintainer of this module, it was unsupported until recently ...


You might try building an access log parser, which parses the access log, or merely gets a line count. Once you have that, create, say, one node per day with a total of the hits per day. You could write a PHP script to do this, or this might help: https://stackoverflow.com/questions/4662725/looking-for-a-php-class-to-parse-an-access-log-file

If you have access you your log files and logrotate, set it to a daily rotation, and parse the previous day's log (access.log.1). A line count should get a simple count of hits, though your may want to explicitly parse out only GET requests, or you might want to separate 200/non-200 requests.

Something else that's a bit more advanced is to install the ECK module and Services, and have a Python script parse the log and post each line into your site. I've found that Views is much faster if you flatten the logs into entities which only have properties, as this requires only one DB table.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.