# Systemd

The *Systemd* input plugin allows to collect log messages from the Journald daemon on Linux environments.

## Configuration Parameters

The plugin supports the following configuration parameters:

| Key                | Description                                                                                                                                                                                                                                                                                                                                                             | Default |
| ------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------- |
| Path               | Optional path to the Systemd journal directory, if not set, the plugin will use default paths to read local-only logs.                                                                                                                                                                                                                                                  |         |
| Max\_Fields        | Set a maximum number of fields (keys) allowed per record.                                                                                                                                                                                                                                                                                                               | 8000    |
| Max\_Entries       | When Fluent Bit starts, the Journal might have a high number of logs in the queue. In order to avoid delays and reduce memory usage, this option allows to specify the maximum number of log entries that can be processed per round. Once the limit is reached, Fluent Bit will continue processing the remaining log entries once Journald performs the notification. | 5000    |
| Systemd\_Filter    | allows to perform a query over logs that contains a specific Journald key/value pairs, e.g: \_SYSTEMD\_UNIT=UNIT. The Systemd\_Filter option can be specified multiple times in the input section to apply multiple filters as required.                                                                                                                                |         |
| Tag                | The tag is used to route messages but on Systemd plugin there is an extra functionality: if the tag includes a star/wildcard, it will be expanded with the Systemd Unit file (e.g: host.\* => host.UNIT\_NAME).                                                                                                                                                         |         |
| DB                 | Specify the absolute path of a database file to keep track of Journald cursor.                                                                                                                                                                                                                                                                                          |         |
| Read\_From\_Tail   | Start reading new entries. Skip entries already stored in Journald.                                                                                                                                                                                                                                                                                                     | false   |
| Strip\_Underscores | Delete underscores at the start of field name. This is useful when logs are further forwarded into elasticsearch, where fields with leading underscore are reserved for internal use.                                                                                                                                                                                   | false   |

## Getting Started

In order to receive Systemd messages, you can run the plugin from the command line or through the configuration file:

### Command Line

From the command line you can let Fluent Bit listen for *Systemd* messages with the following options:

```bash
$ fluent-bit -i systemd \
             -p systemd_filter=_SYSTEMD_UNIT=docker.service \
             -p tag='host.*' -o stdout
```

> In the example above we are collecting all messages coming from the Docker service.

### Configuration File

In your main configuration file append the following *Input* & *Output* sections:

```
[SERVICE]
    Flush        1
    Log_Level    info
    Parsers_File parsers.conf

[INPUT]
    Name            systemd
    Tag             host.*
    Systemd_Filter  _SYSTEMD_UNIT=docker.service

[OUTPUT]
    Name   stdout
    Match  *
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.fluentbit.io/manual/1.0/input/systemd.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
