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

promtail: add "max_age" field to configure cutoff for journal reading #921

Merged
merged 3 commits into from
Aug 21, 2019

Conversation

rfratto
Copy link
Member

@rfratto rfratto commented Aug 20, 2019

The journal scrape config in promtail has been updated to support a "max_age" field. max_age determines the oldest journal entry promtail will read when starting the journal reader. When unspecified, max_age defaults to 7h.

Even if a position in the journal is saved in the promtail positions file, that position may be ignored if the entry corresponding to that position is older than the cutoff time.

Closes #918.

Example promtail config for getting up to the last 12h of journal entries:

server:
  http_listen_port: 9080
  grpc_listen_port: 0

positions:
  filename: /tmp/positions.yaml

clients:
  - url: http://localhost:3100/api/prom/push

scrape_configs:
- job_name: journal
  journal:
    max_age: 12h
    path: /var/log/journal
    labels:
      job: systemd-journal
  relabel_configs:
    - source_labels: ['__journal__systemd_unit']
      target_label: 'unit'

Checklist

  • Documentation added
  • Tests updated

The journal scrape config in promtail has been updated to support
a "cutoff" field. cuttoff determines the oldest journal entry
promtail will read when starting the journal reader. When
unspecified, cutoff defaults to 7h.

Even if a position in the journal is saved in the promtail
positions file, that position may be ignored if the entry corresponding
to that position is older than the cutoff time.

Example promtail config for getting up to the last 12h of journal
entries:

  server:
    http_listen_port: 9080
    grpc_listen_port: 0

  positions:
    filename: /tmp/positions.yaml

  clients:
    - url: http://localhost:3100/api/prom/push

  scrape_configs:
  - job_name: journal
    journal:
      cutoff: 12h
      path: /var/log/journal
      labels:
        job: systemd-journal
    relabel_configs:
      - source_labels: ['__journal__systemd_unit']
        target_label: 'unit'
@rfratto rfratto requested a review from slim-bean August 20, 2019 13:12
@slim-bean
Copy link
Collaborator

Should we call this field "since" which would be consistent with the query api?

@slim-bean
Copy link
Collaborator

hrm on second thought I don't like "since", what about "max_age"?

@rfratto
Copy link
Member Author

rfratto commented Aug 20, 2019

max_age works for me and seems a little more intuitive than cutoff, will push new commit soon

@rfratto rfratto changed the title promtail: add "cutoff" field to configure cutoff for journal reading promtail: add "max_age" field to configure cutoff for journal reading Aug 20, 2019
Copy link
Collaborator

@slim-bean slim-bean left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM!

@rfratto rfratto merged commit 4c41843 into grafana:master Aug 21, 2019
@rfratto rfratto deleted the fix-entry-too-old-journal branch August 21, 2019 19:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

journal reading: Timestamp too old errors
2 participants