Need to track file activity like how often a file was downloaded or opened

Hello Guys,

I hope its the right place to ask … is there a way to track the activity of files e.g. downloads count or view count?
I’ve a shared folder (via link to externals) with some pictures and I would like to know how often which file was downloaded or just viewed. I know about the ‘files_trackdownloads’ and ‘files_downloadactivity’ but thats not exactly what I need.

When do you want to track it? In realtime or afterwards?

I look in my logfiles. The main tool to filter logfiles is grep:


tail -F /var/log/apache2/access.log | grep /s/${sharetoken}

In retrospect:

grep  /s/${sharetoken} /var/log/apache2/access.log
grep  /s/${sharetoken} /var/log/apache2/access.log.1
zgrep  /s/${sharetoken} /var/log/apache2/access.log.2.gz
.. (etc)

There are many more tools to alter the meaningfulness of the created echoes. I have a kind of database with tokens like IP-Adresses to be excluded, scripts to make the logfile more human readable with resolved dns and geo-ip resolution to see, from where the file was opened/downloaded etc.

It’s pretty archaic, but still first-source information :wink:

For some nice pie charts and other statistics I have AWStats running on my Server.

For better reporting or analysis, I think you’d better pushing your access log and nextcloud.log to ElasticSearch or other center log tool.
For my understanding, Nextcloud is a file server, not a download, it does not provide such download metrics directly or I do not know.

Thank you for your input.

I found a way that suits my needs using nextcloud logs, promtail, loki and grafana.