Mastodon Mastodon - Testing logstash configs with Docker
 logo
  • Home 
  • Tags 
  • Blog posts 
  1. Home
  2. Blog posts
  3. Testing logstash configs with Docker

Testing logstash configs with Docker

Posted on June 28, 2016  (Last modified on July 11, 2024) • 1 min read • 118 words
Docker   Logstash   Testing  
Docker   Logstash   Testing  
Share via

On this page
    • Prepare your directories
    • Prepare your logstash config
    • Run logstash
    • Done.

Now this is really not rocket science, but since I might do this more often, I don’t want to google every time.

Prepare your directories  

./tmp                   # THIS IS YOUR WORKING DIRECTORY
  |- patterns/          # optional
  |   |- patternfile1   # optional
  |   |- patternfile2   # optional
  |- logs.log
  |- logstash.conf

Prepare your logstash config  

# logstash.conf
input {
  file {
    path => '/stash/logs.log'
  }
}

filter {
  # whatever config you want to test
  grok {
    match        => [ "message", "%{WHATEVER}" ]
    patterns_dir => '/stash/patterns'              # optional :)
  }
}

output {
  stdout { codec => rubydebug }
}

Run logstash  

docker run --rm -ti -v $(pwd):/stash logstash logstash -f /stash/logstash.conf

Done.  

Done. 🙂

 Quick puppet debugging snippet for Atom
Loathing RSpec and Puppet 
On this page:
    • Prepare your directories
    • Prepare your logstash config
    • Run logstash
    • Done.
In case you want to follow me

Here are some links. The further to the right, the less active.

           
(c) Axel Bock | Powered by Hinode.
Link copied to clipboard
Code copied to clipboard