Hi. I am brand new to Grafana and Promtail / Loki. I am testing with a Quarkus Getting Started app with logging enabled. I have Promtail:latest running in a container.
My log file is at ./var/log/app.log
and whatever is in it when the Promtail container starts shows in the Grafana Loki explorer. All good.
However, if I do something in my Quarkus app that adds records to the myapp.log file, those new records do not appear when I click the Run Query
button in the Loki explorer. If I restart the Promtail container, and click the Run Query
button, those new records appear.
My config.yaml is in ./promtail/config.yaml
My docker compose file in my Quarkus project:
version: '3'
services:
promtail:
image: grafana/promtail:main
volumes:
- ./promtail:/etc/promtail
- ./var/log:/var/log
- ./promtail/config.yaml:/etc/promtail/config.yaml
command: -config.file=/etc/promtail/config.yaml
The .promtail/config.yaml
(API key truncated here)
server:
http_listen_port: 0
grpc_listen_port: 0
positions:
filename: /etc/promtail/positions.yaml
client:
url: https://765067:glc_eyJvIjoiMTAxM...c3QtMSJ9fQ==@logs-prod-026.grafana.net/api/prom/push
basic_auth:
username: 'any-string'
password: 'glc_eyJvIjoiMTAxM...c3QtMSJ9fQ=='
scrape_configs:
- job_name: system
static_configs:
- targets:
- localhost
labels:
job: varlogs
__path__: /var/log/myapp.log
The Promtail container log has this is the final few lines, and no errors:
getting-started-promtail-1 | level=info ts=2023-12-14T05:39:51.444173471Z caller=filetargetmanager.go:361 msg="Adding target" key="/var/log/myapp.log:{job=\"varlogs\"}"
getting-started-promtail-1 | level=info ts=2023-12-14T05:39:51.453864013Z caller=filetarget.go:313 msg="watching new directory" directory=/var/log
getting-started-promtail-1 | level=info ts=2023-12-14T05:39:51.463944805Z caller=tailer.go:147 component=tailer msg="tail routine: started" path=/var/log/myapp.log
getting-started-promtail-1 | ts=2023-12-14T05:39:51.464024721Z caller=log.go:168 level=info msg="Seeked /var/log/myapp.log - &{Offset:5764 Whence:0}"
I notice the Promtail container logs are in UTC and my Quarkus app and Grafana are in UTC+11 but that shouldn’t affect anything as far as I can see. After all, the initial data appears with a query time span of Last 5 minutes. Just nothing after that.
What have I done wrong in my setup, do you think?
Thanks,
Murray