# journal-forwarder
A simple script to forward journald logs over HTTP somewhat reliabily.
## Configuration
All the configuration is passed in as environment variables. Either `JF_URL` or `JF_URL_SRC` is required.
### `JF_DEBUG`
If set to a non-empty string batches are printed to stdout rather than being sent to the configured target.
### `JF_BATCH`
The maximum number of entries to include in a batch. Entries are only sent in batches when logs are backed up. Once caught up entries are always sent live.
Defaults to 100.
### `JF_BATCH_SIZE`
The maximum size of a batch in bytes. If a single entry is longer than this size it will still be sent but in its own "batch".
Defaults to 1 MiB.
### `JF_CURSOR`
The path to a file where to store the cursor of previously transmitted logs. If this file does not exist it will be created and all logs will be uploaded.
Defaults to `./journal-forwarder.cursor`.
### `JF_EXCLUDE_0`
A sequence of field matches that are excluded from uploading. Each is given a sequential number starting with `0`. Processing stops at the first missing number.
Each variable must be in the form `FIELD=value`. Exact matches for this pair are excluded. Any matching exclude is sufficient to prevent a log from being uploaded. Multiple excludes for the same field are possible.
Defaults to no excludes.
### `JF_METHOD`
The HTTP method to use for sending logs.
Defaults to `POST`.
### `JF_URL` or `JF_URL_SRC`
The URL where to upload the logs. `JF_URL` is the URL directly, if not set `JF_URL_SRC` is a path from where to read the URL.
This value is required.
## Requirements
On nixos the following packages are required:
- coreutils
- curl
- gnused
- jq
- systemd
- utillinux (butilt with systemd support)
## Questions
Open an issue so that I can answer and add docs.