Hi All,
Please forgive me if this has already been addressed somewhere but I can’t seem to find it in the documentation or previous posts in Community.
I’ve just started playing around with loki, grafana, alloy, InfluxDB stack on RHEL to get to grips with it all.
Loki worked pretty much out of the box, picking up data from alloy and Grafana can work with it.
However, it just noticed that loki is writing a lot of data (mainly debug messages" to /var/log/messages
How do I change the reporting level so it’s not set to debug for loki?
How do I set loki to write logs to somewhere else, instead of messages (perhaps redhat is picking them up from stdout and dropping them there?).
Apologies for my confusion here. I’m sure it’ll be obvious once someone points me in the right direction, I’m just a bit green
at the mo.
Thanks again 
Are you running Loki in a container or bare metal installation?
Yes. good point - I should have mentioned that.
It’s a straight install. not Docker.
I’ve never run Loki as a bare metal install, so I don’t really know if you can configure it to log to a different location. But with bare metal I think your easiest bet is to look at journal log (such as journalctl -u loki for example), and I think it’s because Loki logs to journal that it ends up in /var/log/messages.
I would also recommend you to simply run Loki in a Docker container, it should be easier to do that even if you intend to run just one Loki instance.
How do I set Loki to write logs to somewhere else?
The /var/log/messages path should be set in the scrape_configs: for your client (Alloy, Agent, Promtail, etc.). Search for __path__: /var/log/messages or __path__: /var/log/*.log in your config file.
Hi @jstickler I think I may need to clarify here.
The data that alloy is picking up and sending to loki is fine.
Loki is logging it’s own debug information into /var/log/messages. It this that I want to change.
Firstly, I want to turn debugging off.
Secondly, I want the logs to be written to somewhere like /var/log/grafana/loki.log if possible.
Thanks for the pointers.
I’ve just got around to looking at this again.
Unfortunately, I can’t run this in a docker at the moment where I am.
I’ve now created a folder called /var/log/loki/ and set the owner to loki.
I’ve altered the /etc/systemd/system/loki.service file, adding the following to the [service] unit:
StandardOutput=append:/var/log/loki/loki.log
StandardError=inherit
LogLevelMax=warning
The logs are now going to the correct place.
However, it’s still outputting debug level text into the log.
Sample:
level=debug ts=2025-08-12T09:54:58.925202377Z caller=mock.go:186 msg=“Get - deadline exceeded” key=collectors/pattern-ring
level=debug ts=2025-08-12T09:54:58.925254386Z caller=mock.go:150 msg=Get key=collectors/pattern-ring wait_index=22
level=debug ts=2025-08-12T09:54:58.925267346Z caller=mock.go:186 msg=“Get - deadline exceeded” key=collectors/compactor
level=debug ts=2025-08-12T09:54:58.925273371Z caller=mock.go:150 msg=Get key=collectors/compactor wait_index=24
level=debug ts=2025-08-12T09:54:58.925278027Z caller=mock.go:186 msg=“Get - deadline exceeded” key=collectors/distributor
I’m assuming there should be some setting to pop into loki’s config yaml file to set the level there?
Can anyone advise on that?
Hi All,
Changing the ExecStart line in the [Service] section to include the -log.level switch has reduced the chatter.
e.g.
ExecStart=/usr/bin/loki -config.file /etc/loki/config.yml -log.level info
However, if possible I’d a better place to set the logging level rather than having to edit the service file.
Is there a parameter that can be placed in the yaml instead?
Yeah, you should be able to do that under server configuration block, see Grafana Loki configuration parameters | Grafana Loki documentation
Something like:
server:
log_level: info
urgh. I don’t know how I missed that!
Thanks for pointing that out
.
Solution
All thanks due to @tonyswumac for their help above.
There were 2 parts to this question now they are both solved here’s the full solution.
In /etc/systemd/system/loki.service add the following to the [Service] section:
StandardOutput=append:/var/log/loki/loki.log
StandardError=inherit
If you also look at the setting for ExecStart in the same file you should see the where the yaml configuration file lives e.g.
ExecStart=/usr/bin/loki -config.file /etc/loki/config.yml
Edit the yaml file to set the logging level to debug, info etc.
e.g.
server:
log_level: info
Also, you’ll need to make the folder where the logs will live and give it the correct ownerships. Something like this:
sudo mkdir /var/log/loki
sudo chown loki:loki /var/log/loki
Once done, you’ll probably need to reload and retart the service like this:
systemctl daemon-reload
sudo service loki restart