STDIN Source

The Vector stdin source ingests data through standard input (STDIN) and outputs log events.

Configuration

vector.toml
[sources.my_source_id]
type = "stdin" # required
  • 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
  • int (bytes)optional

    max_length

    The maxiumum bytes size of a message before it is discarded.

    • Default: 102400 (bytes)
    • View examples

Fields

example log event
{
// ...
"host": "my.host.com",
"message": "Started GET / for 127.0.0.1 at 2012-03-10 14:28:14 +0100",
"timestamp": "2019-11-01T21:15:47+00:00"
// ...
}
  • stringcommonrequired

    host

    The local hostname.

    • No default
    • View examples
  • stringcommonrequired

    message

    The raw message, unaltered.

    • No default
    • View examples
  • timestampcommonrequired

    timestamp

    The exact time the event was ingested.

    • No default
    • View examples

Examples

Given the following input:

2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1

A log event will be output with the following structure:

{
"timestamp": <current_timestamp>,
"message": "2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1",
"host": "<local_hostname>"
}

How It Works

Context

By default, the stdin 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.