Run additional options for logstash in docker container


I would like to run logstash as such:

logstash -e 'input { stdin {}} output { stdout {}}'

but within a docker container, using the logstash official image. Is there a way I can do this? I simply want to test the way it it processes some input text initially, but I don't want to install it directly on the host, because then I need to make sure that the java version is correct and so on, and so forth. So running it within a container would be much more practical.

The problem is that it doesn't work as such, because the default command in the container is a huge java executable, which probably doesn't allow for additional options in a 'normal way'.
Any ideas?

What I've tried thus far is changing the logstash.yml to:

input {
   stdin {}

output {
   stdout {}

But I get:

line 3: cannot unmarshal !!str `input {...` into map[string]interface {}

The input and output sections should be in the logstash.conf, not the logstash.yml.

Thanks for the tip!

So now what I've done is delete the contents of logstash.yml, so that it doesn't try to connect to any elasticsearch instance and put the input/output content into logstash.conf.
It doesn't complain anymore, but I also cannot input any strings while attaching to the container as follows:

docker run -it --name logstash -v logstashconfig:/usr/share/logstash/config

It simply ignores whatever I write. So I'm not sure what I'm doing wrong.
Maybe it would be easier to use curl? And if yes, what default settings am I supposed to use for logstash.conf?

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.