Jump to content

Grafana Loki Docker Logs


Recommended Posts

 I'm trying to setup Grafana Loki so that it is able to ingest Docker logs. The container is running without problems. I have installed the Docker Plugin as specified in the Loki docs, but I'm unable to configure the logging backend. The file "/etc/docker/daemon.json" gets overwritten on every restart.

 

Has anyone actually gotten Loki to work on unRaid? The only related post I was able to find was this one:

 

and I find it hard to believe that no one else has tried running Loki on unRaid or encountered this problem.

Link to comment
1 minute ago, jakobklemm said:

No, this is about a system wide log configuration for docker, that requires that specific file, which gets overwritten by unRaid at startup.

If you want anything to survive a reboot you need to have a copy on the flash drive that you reinstate as part of the startup sequence.

Link to comment
3 minutes ago, jakobklemm said:

I've just tried adding

 

cp /boot/config/daemon.json /etc/docker/daemon.json

 

to the file

/boot/config/go

but that didn't seem to work.

 

Would you be able to link me a resource on how to execute specific commands on startup before docker gets started?

That should work (although it might be necessary to reset permissions).

Link to comment

Just a quick update:

 

The script should work, but the entire /etc/docker folder actually only gets created when the docker service is started, so the script also has to make the directory before copying the file.

 

(I also realized that this entire approach doesn't really work for my use case at the moment because I have Loki running in a dedicated network to which the unRaid host doesn't have access (I'm aware of the setting to enable it, but that is broken and the workaround is a little to sketchy for my taste), so I'll try to work with a different logging solution. )

Link to comment
  • 2 months later...
  • 2 months later...

Hello!
I am facing the same issues you are. To be able to push the log files to loki the file `/etc/docker/daemon.json` needs to be edited to include
 

{
   "log-driver": "loki",
    "log-opts": {
        "loki-url": "http://localhost:3100/loki/api/v1/push",
        "loki-batch-size": "400"
}

However when I restart the docker service with `/etc/rc.d/rc.docker stop` and  `/etc/rc.d/rc.docker start` an error gets logged to `/var/log/docker.log` showing
 

unable to configure the Docker daemon with file /etc/docker/daemon.json: the following directives don't match any configuration option: loki-url, loki-batch-size


I have the docker driver installed (installed using `docker plugin install grafana/loki-docker-driver:latest --alias loki --grant-all-permissions`) and verified using `docker plugin ls`
 

Link to comment

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...