Skip to content

Commit

Permalink
Document systemd journal scraping (#1261)
Browse files Browse the repository at this point in the history
  • Loading branch information
rfratto authored Nov 25, 2019
1 parent 20bb95f commit 91bbe86
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions docs/clients/promtail/scraping.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,37 @@ relabel_configs:
See [Relabeling](#relabeling) for more information.
## Journal Scraping (Linux Only)
On systems with `systemd`, Promtail also supports reading from the journal. Unlike
file scraping which is defined in the `static_configs` stanza, journal scraping is
defined in a `journal` stanza:

```yaml
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'
```

All fields defined in the `journal` section are optional, and are just provided
here for reference. The `max_age` field ensures that no older entry than the
time specified will be sent to Loki; this circumvents "entry too old" errors.
The `path` field tells Promtail where to read journal entries from. The labels
map defines a constant list of labels to add to every journal entry that Promtail
reads.

When Promtail reads from the journal, it brings in all fields prefixed with
`__journal_` as internal labels. Like in the example above, the `_SYSTEMD_UNIT`
field from the journal was transformed into a label called `unit` through
`relabel_configs`. See [Relabeling](#relabeling) for more information.

## Relabeling

Each `scrape_configs` entry can contain a `relabel_configs` stanza.
Expand Down

0 comments on commit 91bbe86

Please sign in to comment.