Search code examples
vectordatadog

How do I stop Vector crashing when an empty line is logged?


I'm new to Vector and was trying to monitor some of my existing containers, but one of them outputs an empty line of text and this causes Vector to crash with:

thread 'vector-worker' panicked at src/sinks/aws_cloudwatch_logs/request_builder.rs:111:52: payload should never be zero length

I have a very simple config:

sources:
    dummy_logs:
        type: "docker_logs"
        docker_host: "/path_to/docker.sock"

sinks:
    print:
        type: "aws_cloudwatch_logs"
        inputs: ["dummy_logs"]
        group_name: "/my/group"
        stream_name: "%Y/%m/%d/my-stream"
        encoding:
            codec: "text"

It's easy to reproduce. Run these command in separate windows:

vector --config my_config.yaml

docker run -it --rm alpine /bin/sh

Then, inside the docker shell:

ls - this works file

echo - this, on its own, causes Vector to exit


Solution

  • Try adding a filter transform

    transforms:
      my_transform_id:
        type: filter
        inputs: ["dummy_logs"]
        condition: .message != ""