Is it possible to hook up goaccess to automatically read all the logs from docker services in a docker-composed system?
Most examples show how to build GoAccess with docker, but I'm more interested in how other services would use it to push logs.
Perhaps an example will make it clearer, here is what I mean (this is utilizing oklogger):
https://gist.github.com/drozzy/06d1b2e48beac9527f5777cd1cd02492
@drozzy Sorry, I'm not sure as I don't work a lot with docker, but maybe @coldfix can offer some thoughts on this?
Sure, I'm doing that for my blog: https://github.com/coldfix/server/blob/master/docker-compose.yml
Thank you, @coldfix. Could you explain a little bit how it works? Looks like you are not using docker logging drivers, am I right?
Thanks.
I didn't know there was anything like special docker logging drivers, sorry. I'm simply sharing volumes between the goaccess container and the webserver (nginx here).
Oh, I see. So I would need to figure out where each service stores logs?
Closing this. Feel free to reopen it if needed.
hey @drozzy , did you end up finding a solution?
@frankfuu Sorry, I just ended up using Loggly.
Thanks @drozzy. I'll look into that
In case anybody is still looking and really keen on docker + live stats, you can hack around this by tailing the docker log of your webserver into goaccess from within the goaccess container itself.
Here's how it looks like with Docker Swarm, with nginx service being frontend_nginx.
goaccess:
image: allinurl/goaccess
command: sh -c "apk add --update --no-cache docker && docker service logs -f --raw frontend_nginx 2>&1| goaccess --no-global-config --real-time-html --log-format=COMBINED -"
ports:
- published: 7890
target: 7890
protocol: tcp
mode: host
deploy:
placement:
constraints: [node.role == manager]
volumes:
- /var/run/docker.sock:/var/run/docker.sock
- ./goaccess/data:/srv/data
- ./goaccess/report:/srv/report
@bard Thanks for sharing that!
Most helpful comment
In case anybody is still looking and really keen on docker + live stats, you can hack around this by tailing the docker log of your webserver into
goaccessfrom within thegoaccesscontainer itself.Here's how it looks like with Docker Swarm, with nginx service being
frontend_nginx.