logstash-plugins / logstash-input-stdin

Apache License 2.0
6 stars 16 forks source link

When STDIN hits EOF, contents of buffer are not flushed. #17

Open yaauie opened 6 years ago

yaauie commented 6 years ago

If we have the following, without a trailing newline:

one
two
three
four

Logstash shuts down before emitting the partially-read line four:

╭─{ yaauie@castrovel:~/src/elastic/discuss-scratch/127387-stdin-eof }
╰─○ cat no-trailing-eof.lines | ~/src/elastic/releases/logstash-6.2.2/bin/logstash -e 'input { stdin {} } output { stdout {} }'
Sending Logstash's logs to /Users/yaauie/src/elastic/releases/logstash-6.2.2/logs which is now configured via log4j2.properties
[2018-04-12T17:50:57,748][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"fb_apache", :directory=>"/Users/yaauie/src/elastic/releases/logstash-6.2.2/modules/fb_apache/configuration"}
[2018-04-12T17:50:57,772][INFO ][logstash.modules.scaffold] Initializing module {:module_name=>"netflow", :directory=>"/Users/yaauie/src/elastic/releases/logstash-6.2.2/modules/netflow/configuration"}
[2018-04-12T17:50:57,980][WARN ][logstash.config.source.multilocal] Ignoring the 'pipelines.yml' file because modules or command line options are specified
[2018-04-12T17:50:58,512][INFO ][logstash.runner          ] Starting Logstash {"logstash.version"=>"6.2.2"}
[2018-04-12T17:50:58,911][INFO ][logstash.agent           ] Successfully started Logstash API endpoint {:port=>9600}
[2018-04-12T17:50:59,992][INFO ][logstash.pipeline        ] Starting pipeline {:pipeline_id=>"main", "pipeline.workers"=>8, "pipeline.batch.size"=>125, "pipeline.batch.delay"=>50}
[2018-04-12T17:51:00,116][INFO ][logstash.pipeline        ] Pipeline started succesfully {:pipeline_id=>"main", :thread=>"#<Thread:0xa2d883b run>"}
[2018-04-12T17:51:00,284][INFO ][logstash.agent           ] Pipelines running {:count=>1, :pipelines=>["main"]}
2018-04-12T17:51:00.177Z castrovel.local one
2018-04-12T17:51:00.207Z castrovel.local two
2018-04-12T17:51:00.208Z castrovel.local three
[2018-04-12T17:51:00,562][INFO ][logstash.pipeline        ] Pipeline has terminated {:pipeline_id=>"main", :thread=>"#<Thread:0xa2d883b run>"}
[success (18.000s)]