Skip to content

Latest commit

 

History

History
149 lines (107 loc) · 5 KB

stdin.md

File metadata and controls

149 lines (107 loc) · 5 KB
description Ingests data through standard input (STDIN) and outputs `log` events.

stdin source

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

Example

{% code-tabs %} {% code-tabs-item title="vector.toml (simple)" %}

[sources.my_source_id]
  type = "stdin" # must be: "stdin"

{% endcode-tabs-item %} {% code-tabs-item title="vector.toml (advanced)" %}

[sources.my_source_id]
  # REQUIRED - General
  type = "stdin" # must be: "stdin"
  
  # OPTIONAL - General
  max_length = 102400 # default, bytes
  
  # OPTIONAL - Context
  host_key = "host" # default

{% endcode-tabs-item %} {% endcode-tabs %}

Options

host_key

optional default: "host" type: string

The key name added to each event representing the current host. See Context for more info.

max_length

optional default: 102400 type: int unit: bytes

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

Input/Output

Given the following input line:

{% code-tabs %} {% code-tabs-item title="stdin" %}

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

{% endcode-tabs-item %} {% endcode-tabs %}

A log event will be output with the following structure:

{% code-tabs %} {% code-tabs-item title="log" %}

{
  "timestamp": <timestamp> # current time,
  "message": "2019-02-13T19:48:34+00:00 [info] Started GET "/" for 127.0.0.1",
  "host": "10.2.22.122" # current hostname
}

The "timestamp" and "host" keys were automatically added as context. You can further parse the "message" key with a transform, such as the regex_parser transform. {% endcode-tabs-item %} {% endcode-tabs %}

How It Works

Context

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

Delivery Guarantee

This component offers an at least once delivery guarantee if your pipeline is configured to achieve this.

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.

Troubleshooting

The best place to start with troubleshooting is to check the Vector logs. This is typically located at /var/log/vector.log, then proceed to follow the Troubleshooting Guide.

If the Troubleshooting Guide does not resolve your issue, please:

  1. Check for any open stdin_source issues.
  2. If encountered a bug, please file a bug report.
  3. If encountered a missing feature, please file a feature request.
  4. If you need help, join our chat/forum community. You can post a question and search previous questions.

Resources