STDIN Source

The Vector stdin source receives logs from STDIN.

Configuration

[sources.my_source_id]
type = "stdin" # required
  • optionalstring

    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.

    • Default: "host"
  • optionaluint

    max_length

    The maximum bytes size of a message before rest of it will be discarded.

    • Default: 102400 (bytes)

Output

This component outputs log events with the following fields:

{
"host" : "my-host.local",
"message" : "2019-02-13T19:48:34+00:00 [info] Started GET \"/\" for 127.0.0.1",
"timestamp" : "2020-10-10T17:07:36+00:00"
}
  • commonrequiredstring

    host

    The local hostname, equivalent to the gethostname command.

    • View examples
  • commonrequiredstring

    message

    The raw line, unparsed.

    • View examples
  • commonrequiredtimestamp

    timestamp

    The exact time the event was ingested into Vector.

    • View examples

Telemetry

This component provides the following metrics that can be retrieved through the internal_metrics source. See the metrics section in the monitoring page for more info.

  • counter

    stdin_reads_failed_total

    The total number of errors reading from stdin. This metric includes the following tags:

    • component_kind - The Vector component kind.

    • component_name - The Vector component ID.

    • component_type - The Vector component type.

    • instance - The Vector instance identified by host and port.

    • job - The name of the job producing Vector metrics.

  • counter

    processed_events_total

    The total number of events processed by this component. This metric includes the following tags:

    • component_kind - The Vector component kind.

    • component_name - The Vector component ID.

    • component_type - The Vector component type.

    • file - The file that produced the error

    • instance - The Vector instance identified by host and port.

    • job - The name of the job producing Vector metrics.

  • counter

    processed_bytes_total

    The total number of bytes processed by the component. This metric includes the following tags:

    • component_kind - The Vector component kind.

    • component_name - The Vector component ID.

    • component_type - The Vector component type.

    • instance - The Vector instance identified by host and port.

    • job - The name of the job producing Vector metrics.

Examples

Given the following input:

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

And the following configuration:

[sources.stdin]
type = "stdin"

The following Vector log event will be output:

{
"timestamp": "2020-10-10T17:07:36.452332Z",
"message": "2019-02-13T19:48:34+00:00 [info] Started GET \"/\" for 127.0.0.1",
"host": "my-host.local"
}

How It Works

Context

By default, the stdin source will augment events with helpful context keys as shown in the "Output" section.

Line Delimiters

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