What’s the best way to test Logstash pipelines in CI?

0
0
Asked By MellowOrbit42 On

I've been working extensively with Logstash and want a reliable way to test filter behavior automatically before changes reach a development environment. Ideally, the tests would use fixture events, replace production inputs and outputs with local test plugins, and make assertions about the resulting events.

Using Docker to run a complete ELK stack is possible, but it feels unnecessarily heavy. Some of our real inputs and outputs, such as AWS Kinesis and Datadog, also aren't convenient for local tests. The goals are to give the team more confidence when modifying pipelines and to catch breaking changes before they are merged. How are others testing Logstash configurations in CI?

3 Answers

Answered By CopperMeadow5 On

If you’re able to reconsider the technology, Vector is worth evaluating because its tap functionality makes pipeline output easy to inspect. If Logstash is required, a simpler approach is to replace the production output with the stdout plugin and capture or parse that output during the test. Splitting production inputs and outputs away from the filter logic makes this much easier.

Answered By PineappleHarbor7 On

The logstash-filter-verifier project can still be useful even though it hasn’t had a recent release. The configuration format it targets hasn’t changed much, and we still run it in CI. We separated the pipeline so the input and output sections are in one file while the filter block is reusable on its own. Tests then use a generator or standard input and send results to the stdout rubydebug output instead of touching Kinesis or Datadog. From there, we feed in fixture events and assert against the emitted JSON without starting a full ELK stack.

Answered By QuietLynx28 On

We use integration tests with a minimal Logstash container. The tests provide sample events through a file input, wait for the pipeline to process them, and compare the resulting output with expected data. It adds some startup time, but it has been effective at catching filter regressions in CI.

Related Questions

LEAVE A REPLY

Please enter your comment!
Please enter your name here

This site uses Akismet to reduce spam. Learn how your comment data is processed.