Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to make Promtail worked with Jornald #1057

Closed
Alexvianet opened this issue Sep 25, 2019 · 2 comments · Fixed by #1072
Closed

How to make Promtail worked with Jornald #1057

Alexvianet opened this issue Sep 25, 2019 · 2 comments · Fixed by #1072
Assignees
Labels
component/packaging type/bug Somehing is not working as expected

Comments

@Alexvianet
Copy link

Environment: CentOS7
https://github.com/grafana/loki/releases/download/v0.3.0/loki_linux_amd64.gz
https://github.com/grafana/loki/releases/download/v0.3.0/promtail_linux_amd64.gz
on the same host

● promtail.service - promtail
   Loaded: loaded (/etc/systemd/system/promtail.service; enabled; vendor preset: disabled)
   Active: active (running) since Wed 2019-09-25 15:15:40 UTC; 7min ago
 Main PID: 12588 (promtail)
   CGroup: /system.slice/promtail.service
           └─12588 /usr/local/bin/promtail -config.file /etc/promtail/promtail_config.yaml -log.level info

/etc/promtail/promtail_config.yaml

server:
  http_listen_port: 9101
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

client:
  url: http://127.0.0.1:3100/api/prom/push

scrape_configs:
  - job_name: system
    static_configs:
    - targets:
        - localhost
      labels:
        hostname: "loki-01.prometheus.local"
        job: varlogs
        __path__: /var/log/messages
  - job_name: journal
    journal:
      path: /var/log/journal
      labels:
        job: systemd-journal
        hostname: "loki-01.prometheus.local"
    relabel_configs:
      - source_labels: ['__journal__systemd_unit']
        target_label: 'unit'

/etc/systemd/journald.conf

[Journal]
Storage=persistent
#Compress=yes

[root@loki-01 ~]# ls /var/log/journal/93f219319dd5bdb42d9f1c8f2e23d329/system.journal
/var/log/journal/93f219319dd5bdb42d9f1c8f2e23d329/system.journal

Sep 25 15:15:40 loki-01.prometheus.local systemd[1]: Stopped promtail.
Sep 25 15:15:40 loki-01.prometheus.local systemd[1]: Started promtail.
Sep 25 15:15:40 loki-01.prometheus.local promtail[12588]: level=warn ts=2019-09-25T15:15:40.960180013Z caller=filetargetmanager.go:98 msg="WARNING!!! entry_parser config is deprecated, please change to pipeline_stages"
Sep 25 15:15:40 loki-01.prometheus.local promtail[12588]: level=warn ts=2019-09-25T15:15:40.960517591Z caller=journaltargetmanager.go:24 msg="WARNING!!! Journal target manager initialized on platform without Journal support!"
Sep 25 15:15:40 loki-01.prometheus.local promtail[12588]: level=info ts=2019-09-25T15:15:40.960828159Z caller=server.go:120 http=[::]:9101 grpc=[::]:45824 msg="server listening on addresses"
Sep 25 15:15:40 loki-01.prometheus.local promtail[12588]: level=info ts=2019-09-25T15:15:40.961153487Z caller=main.go:55 msg="Starting Promtail" version="(version=v0.3.0, branch=HEAD, revision=c673380b)"
Sep 25 15:15:45 loki-01.prometheus.local promtail[12588]: level=info ts=2019-09-25T15:15:45.961486369Z caller=filetargetmanager.go:257 msg="Adding target" key="{hostname=\"loki-01.prometheus.local\", job=\"varlogs\"}"
Sep 25 15:15:45 loki-01.prometheus.local promtail[12588]: level=info ts=2019-09-25T15:15:45.962279466Z caller=tailer.go:77 component=tailer msg="start tailing file" path=/var/log/messages
Sep 25 15:15:45 loki-01.prometheus.local promtail[12588]: ts=2019-09-25T15:15:45.962391598Z caller=log.go:124 component=tailer level=info msg="Seeked /var/log/messages - &{Offset:20558240 Whence:0}"

In Grafana I can see only messages logs
What I am doing wrong?
Please help)

@rfratto
Copy link
Member

rfratto commented Sep 25, 2019

Hi, it looks like the binaries we shipped don't have journal support enabled, but they should. I'll look into it, but if you don't want to wait for a fix, you can try building Promtail yourself by cloning Loki and running make promtail.

@rfratto rfratto self-assigned this Sep 25, 2019
@Alexvianet
Copy link
Author

Alexvianet commented Sep 25, 2019 via email

rfratto added a commit to rfratto/loki that referenced this issue Sep 26, 2019
The published binary of promtail for linux/amd64 was not built with CGO
support, so journal tailing could not be used.

This is kind of a dirty hack: we just re-build promtail at the end of
building everything else with CGO enabled. It's not clear how it could
be done more cleanly.

Fixes grafana#1057.
cyriltovena pushed a commit that referenced this issue Oct 2, 2019
* build: override promtail release build with cgo-enabled binary

The published binary of promtail for linux/amd64 was not built with CGO
support, so journal tailing could not be used.

This is kind of a dirty hack: we just re-build promtail at the end of
building everything else with CGO enabled. It's not clear how it could
be done more cleanly.

Fixes #1057.

* build: break out gox builds
@chaudum chaudum added the type/bug Somehing is not working as expected label Jun 14, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
component/packaging type/bug Somehing is not working as expected
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants