goaccess
goaccess copied to clipboard
Persist via cron
First off, great project. My basic question is this, I'm currently using
zcat access.log.*.gz | goaccess --ignore-crawlers access.log access.log.1 - -o report.html --log-format=COMBINED
to generate my report. I run this via cron once an hour. How would I modify this, or is it even possible, to have it persist from today onward, or would I have to constantly go and and write a new --persist
and --restore
each day manually? As basically, I want to be able to keep logs for months, or even years of traffic growth
Hi @nadermx
Yes. A simplest form is using --persirt
and --restore
option.
Perhaps it is unique form.
Another option could be to use real-time monitoring. However, You did not had a final Report HTML. In this way, GoAccess will be run into reat-time mode. And, each hour, You could add new Log to processing.
A example for RT You can be into http://rt.goaccess.io/.
I hope that I had help you.
It is very helpful, yet I'm still a bit confused. So you are saying if I use realtime, that from there I could do what? Could you give me a example command or pseduo code, as I'm still a bit confused
Sorry for the late post. I'd run it once as:
# zcat access.log.*.gz | goaccess --ignore-crawlers access.log.1 - -o report.html --log-format=COMBINED --persist
and then just keep adding data to the db as:
# goaccess --ignore-crawlers access.log -o report.html --log-format=COMBINED --persist --restore
Every time the log rotates, access.log would be the newest and you would just keep adding the new data on top it.
Give it a shot and let us know how it goes.
Also, before you try that, I'd make sure to the delete current runs that you may have persisted before, e.g.,
# rm -rf /tmp/*.db