stdin

Collect logs sent via stdin

status: stable role: sidecar delivery: at-least-once egress: stream state: stateless output: log

Configuration

Example configurations

{
  "sources": {
    "my_source_id": {
      "type": "stdin"
    }
  }
}
[sources.my_source_id]
type = "stdin"
---
sources:
  my_source_id:
    type: stdin
{
  "sources": {
    "my_source_id": {
      "type": "stdin",
      "host_key": "host",
      "max_length": 102400
    }
  }
}
[sources.my_source_id]
type = "stdin"
host_key = "host"
max_length = 102_400
---
sources:
  my_source_id:
    type: stdin
    host_key: host
    max_length: 102400

host_key

optional string
The key name added to each event representing the current host. This can also be globally set via the global host_key option.
default: host

max_length

optional uint
The maximum bytes size of a message before rest of it will be discarded.
default: 102400 (bytes)

Output

Logs

line

An individual event from STDIN.

Telemetry

Metrics

link

events_in_total

counter
The number of events accepted by this component either from tagged origin like file and uri, or cumulatively from other origins.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
container_name optional
The name of the container from which the event originates.
file optional
The file from which the event originates.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the event originates.
peer_path optional
The pathname from which the event originates.
pod_name optional
The name of the pod from which the event originates.
uri optional
The sanitized URI from which the event originates.

events_out_total

counter
The total number of events emitted by this component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

processed_bytes_total

counter
The number of bytes processed by the component.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.
container_name optional
The name of the container from which the bytes originate.
file optional
The file from which the bytes originate.
mode optional
The connection mode used by the component.
peer_addr optional
The IP from which the bytes originate.
peer_path optional
The pathname from which the bytes originate.
pod_name optional
The name of the pod from which the bytes originate.
uri optional
The sanitized URI from which the bytes originate.

processed_events_total

counter
The total number of events processed by this component. This metric is deprecated in place of using events_in_total and events_out_total metrics.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

stdin_reads_failed_total

counter
The total number of errors reading from stdin.
component_kind required
The Vector component kind.
component_name required
The Vector component name.
component_type required
The Vector component type.

Examples

STDIN line

Given this event...
```text
2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1
```
...and this configuration...
[sources.my_source_id]
type = "stdin"
---
sources:
  my_source_id:
    type: stdin
{
  "sources": {
    "my_source_id": {
      "type": "stdin"
    }
  }
}
...this Vector event is produced:
{
  "log": {
    "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.452332Z"
  }
}

How it works

Context

By default, the stdin source augments events with helpful context keys.

Line Delimiters

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

State

This component is stateless, meaning its behavior is consistent across each input.