agolo / logstash-test-runner

Logstash configuration testing framework
https://blog.agolo.com/the-easy-way-to-test-your-logstash-configuration-3f80eb5ffd59
MIT License
103 stars 24 forks source link
devops logstash testing

logstash-test-runner

image

Example tests are in the __tests__ directory. To add a tests, simply add a new directory with the given input input.log, the ETL configuration logstash.conf, and the expected output output.log.

Prerequisites

Setup

__tests__
  crawlers
    input.log
    logstash.conf
    output.log
  mongo
    input.log
    logstash.conf
    output.log
  # ...
# ./test.sh <test-parent-directory> [<logstash-docker-image>]

# Run tests using the official Logstash 5.5.1 docker image
./test.sh __tests__

# Run tests using a locally built logstash docker image
./test.sh __tests__ my_logstash_image:mytag

NOTE: Multiline logs in logstash need translate in reverse to filebeat in terms of multiline.match from previous => after and next => before.

Ignoring Timestamps

By default, we ignore timestamp and @timestamp fields. You can customize this in the ./test.sh where we use the ignore flag like so ./log-diff.js -i.