Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 21 additions & 0 deletions pipeline/inputs/systemd.md
Original file line number Diff line number Diff line change
Expand Up @@ -77,3 +77,24 @@ pipeline:
```
{% endtab %}
{% endtabs %}

### Parsing the MESSAGE field
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
### Parsing the MESSAGE field
### Parsing the `MESSAGE` field


By default, the _Systemd_ plugin logs all fields in the journal verbatim. If you want to parse the `MESSAGE` field, you can configure your service to specify a parser. For example, to parse the `MESSAGE` field as JSON, you can use something like the following systemd configuration:

```yaml
[Unit]
Description=my-service
After=network.target

[Service]
WorkingDirectory=/var/lib/my-service
ExecStart=/usr/sbin/my-service
Restart=always
LogExtraFields=FLUENT_BIT_PARSER=json

[Install]
WantedBy=multi-user.target
```

`LogExtraFields` will make the specified fields appear in the log output. The `Systemd` plugin will look for a `FLUENT_BIT_PARSER` field and use it to parse the `MESSAGE` field. If the parser is not found or parsing fails, the unparsed message is added to the log entry as if no parser was specified.
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
`LogExtraFields` will make the specified fields appear in the log output. The `Systemd` plugin will look for a `FLUENT_BIT_PARSER` field and use it to parse the `MESSAGE` field. If the parser is not found or parsing fails, the unparsed message is added to the log entry as if no parser was specified.
`LogExtraFields` adds the specified fields to the log output. The `Systemd` plugin looks for a `FLUENT_BIT_PARSER` field and uses it to parse the `MESSAGE` field. If the parser is not found or parsing fails, the unparsed message is added to the log entry as if no parser was specified.