Vector

Vector is a lightweight and ultra-fast tool for building observability pipelines. It can be used to replace Logstash, Fluent, Telegraf, Beats, or similar tools.

Vector has built-in support for shipping logs to Humio through the humio_logs sink.

Installation

Vector can be installed on Linux, Windows, and MacOS. The Vector documentation includes several methods of installation.

Configuration

Sending data to Humio with Vector is very easy using the humio_logs sink. We only need the URL of the Humio cluster and an ingest token.

In the example below we configure Vector to read from standard input (stdin) and send each line to the Humio cluster. Messages entered at the command line after starting Vector will be sent to Humio.

  1. Create the file vector.toml

    data_dir = "/var/lib/vector"
    
    # stdin source: https://vector.dev/docs/reference/sources/stdin/
    [sources.my_stdin_source]
    type = "stdin"
    
    # humio sink: https://vector.dev/docs/reference/sinks/humio_logs/
    [sinks.my_humio_cluster]
    # set type to "humio" in version 0.8.0
    # https://github.com/timberio/vector/issues/1971
    type = "humio_logs"
    inputs = ["my_stdin_source"]
    host = "${HUMIO_URL}"
    token = "${HUMIO_INGEST_TOKEN}"
    
  2. Run Vector with the environment variables HUMIO_URL and HUMIO_INGEST_TOKEN set appropriately and enter test messages

    HUMIO_URL=http://localhost:8080 HUMIO_INGEST_TOKEN=KL95YdaSYEWJ1tV9CPEqWGdMi4FVXghD0xxGrDAU3Wg5 vector --config vector.toml
    Mar 04 13:40:19.770  INFO vector: Log level "info" is enabled.
    Mar 04 13:40:19.770  INFO vector: Loading configs. path=["vector.toml"]
    Mar 04 13:40:19.773  INFO vector: Vector is starting. version="0.8.1" git_version="v0.8.1" released="Wed, 04 Mar 2020 15:11:57 +0000" arch="x86_64"
    Mar 04 13:40:19.773  INFO vector::topology: Running healthchecks.
    Mar 04 13:40:19.773  INFO vector::topology: Starting source "my_stdin_source"
    Mar 04 13:40:19.773  INFO vector::topology: Starting sink "my_humio_cluster"
    Mar 04 13:40:19.774  INFO source{name=my_stdin_source type=stdin}: vector::sources::stdin: Capturing STDIN
    Mar 04 13:40:19.781  INFO vector::topology::builder: Healthcheck: Passed.
    Example Message 1
    Example Message 2
    
  3. Search your Humio repository for the test messages

    The messages in Humio will have the following structure. Note that Vector adds timestamp and host to the messages.

    {"@timestamp":1583349673000,"#type":"none","host":"MacBook-Pro.local","#repo":"vector-example","@timezone":"Z","message":"Example Message 2","@rawstring":"{\"host\":\"Daniels-MacBook-Pro.local\",\"message\":\"Example Message 2\"}","@id":"mENFVMQVJyQ2M5pV4D1sFMB9_1_1_1583349673"}
    {"@timestamp":1583349669000,"#type":"none","host":"MacBook-Pro.local","#repo":"vector-example","@timezone":"Z","message":"Example Message 1","@rawstring":"{\"host\":\"Daniels-MacBook-Pro.local\",\"message\":\"Example Message 1\"}","@id":"mENFVMQVJyQ2M5pV4D1sFMB9_1_0_1583349669"}