Syslog Source

The Vector syslog source ingests data through the Syslog protocol and outputs log events.

Requirements

Configuration

vector.toml
[sources.my_source_id]
type = "syslog" # required
address = "0.0.0.0:514" # required, required when mode = "tcp" or mode = "udp"
mode = "tcp" # required
path = "/path/to/socket" # required, required when mode = "unix"
  • stringoptional

    host_key

    The key name added to each event representing the current host. This can also be globally set via the global [host_key](#host_key) option.

    See Context for more info.

    • Default: "host"
    • View examples
  • stringcommonrequired*

    address

    The TCP or UDP address to listen for connections on, or "systemd#N" to use the Nth socket passed by systemd socket activation.

    • Only required when: mode = ["tcp","udp"]
    • No default
    • View examples
  • int (bytes)optional

    max_length

    The maximum bytes size of incoming messages before they are discarded.

    • Default: 102400 (bytes)
    • View examples
  • stringenumcommonrequired

    mode

    The input mode.

    • No default
    • Enum, must be one of: "tcp" "udp" "unix"
    • View examples
  • stringcommonrequired*

    path

    The unix socket path. This should be absolute path.

    • Only required when: mode = "unix"
    • No default
    • View examples
  • tableoptional

    tls

    Configures the TLS options for connections from this source.

    • stringoptional

      ca_path

      Absolute path to an additional CA certificate file, in DER or PEM format (X.509).

      • No default
      • View examples
    • stringcommonoptional

      crt_path

      Absolute path to a certificate file used to identify this server, in DER or PEM format (X.509) or PKCS#12. If this is set and is not a PKCS#12 archive, key_path must also be set. This is required if enabled is set to true.

      • No default
      • View examples
    • boolcommonoptional

      enabled

      Require TLS for incoming connections. If this is set, an identity certificate is also required.

      • Default: false
      • View examples
    • stringcommonoptional

      key_pass

      Pass phrase used to unlock the encrypted key file. This has no effect unless key_path is set.

      • No default
      • View examples
    • stringcommonoptional

      key_path

      Absolute path to a certificate key file used to identify this server, in DER or PEM format (PKCS#8).

      • No default
      • View examples
    • booloptional

      verify_certificate

      If true, Vector will require a TLS certificate from the connecting host and terminate the connection if it is not valid. If false (the default), Vector will not request a certificate from the client.

      • WARNING: Setting this to `false` will cause OpenSSL to not request a certificate from the client
      • Default: false
      • View examples

Fields

example log event
{
// ...
"appname": "app-name",
"facility": "1",
"host": "my.host.com",
"message": "<13>Feb 13 20:07:26 74794bfb6795 root[8539]: i am foobar",
"msgid": "ID47",
"procid": "8710",
"severity": "notice",
"timestamp": "2019-11-01T21:15:47+00:00",
"version": 1,
"custom_field1": "custom value 1"
// ...
}
  • stringoptional

    appname

    The appname extracted from the Syslog formatted line. If a appname is not found, then the key will not be added.

    • No default
    • View examples
  • stringoptional

    facility

    The facility extracted from the Syslog line. If a facility is not found, then the key will not be added.

    • No default
    • View examples
  • stringcommonrequired

    host

    The hostname extracted from the Syslog line. If a hostname is not found, then Vector will use the upstream hostname. In the case where mode = "unix" the socket path will be used. This key can be renamed via the host_key option.

    • No default
    • View examples
  • stringcommonrequired

    message

    The raw message, unaltered.

    See Parsing for more info.

    • No default
    • View examples
  • stringoptional

    msgid

    The msgid extracted from the Syslog line. If a msgid is not found, then the key will not be added.

    • No default
    • View examples
  • stringoptional

    procid

    The procid extracted from the Syslog line. If a procid is not found, then the key will not be added.

    • No default
    • View examples
  • stringoptional

    severity

    The severity extracted from the Syslog line. If a severity is not found, then the key will not be added.

    • No default
    • View examples
  • timestampcommonrequired

    timestamp

    The timestamp extracted from the incoming line. If a timestamp is not found, then Vector will use the current time.

    • No default
    • View examples
  • intoptional

    version

    The version extracted from the Syslog line. If a version is not found, then the key will not be added.

    • No default
    • View examples
  • *optional

    [field-name]

    In addition to the defined fields, any Syslog 5424 structured fields are parsed and inserted as root level fields.

    • No default
    • View examples

Examples

Given the following Syslog 5424 log line:

<13>1 2020-03-13T20:45:38.119Z dynamicwireless.name non 2426 ID931 [exampleSDID@32473 iut="3" eventSource= "Application" eventID="1011"] Try to override the THX port, maybe it will reboot the neural interface!

A log event will be produced with the following structure:

{
"severity": "notice",
"facility": "user",
"timestamp": "2020-03-13T20:45:38.119Z",
"host": "dynamicwireless.name", // controlled via the [`host_key`](#host_key) option,
"appname": "non",
"procid": "2426",
"msgid": "ID931",
"iut": "3",
"eventSource": "Application",
"eventID": "1011",
"message": "Try to override the THX port, maybe it will reboot the neural interface!"
}

How It Works

Context

By default, the syslog source will add context keys to your events via the host_key options.

Environment Variables

Environment variables are supported through all of Vector's configuration. Simply add ${MY_ENV_VAR} in your Vector configuration file and the variable will be replaced before being evaluated.

You can learn more in the Environment Variables section.

Line Delimiters

Each line is read until a new line delimiter (the 0xA byte) is found.

Parsing

Vector makes a best effort to parse the various Syslog formats out in the wild. This includes RFC 5424, RFC 3164, and other common variations (such as the Nginx Syslog style). It's unfortunate that the Syslog specification is not more accurately followed, but we hope Vector insulates you from these diviations.

If parsing fails, Vector will include the entire Syslog line in the message key. If you find this happening often, we recommend using the socket source combined with the regex_parser transform to implement your own ingestion and parsing scheme. Or, open an issue requesting support for your specific format.

TLS

Vector uses Openssl for TLS protocols for it's battle-tested and reliable security. You can enable and adjust TLS behavior via the tls.* options.