Skip to content

Instantly share code, notes, and snippets.

@greem
Last active August 29, 2015 14:04
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save greem/517e8103410846788a58 to your computer and use it in GitHub Desktop.
Save greem/517e8103410846788a58 to your computer and use it in GitHub Desktop.
logstash waiting for file input
This refers to the thread on the LS mailing list:
https://groups.google.com/forum/#!msg/logstash-users/6EiyGnQQnNM/41fcJr-eet4J
where a user was having problems getting LS to start as they would have expected. Long story short, the "file" input will wait forever for a file if it doesn't exist.
[root@lumberjack ~]# /opt/logstash/bin/logstash --debug -e 'input { file { path => "/tmp/thingy-for-logstash" start_position => "beginning" sincedb_path => "/dev/null" } } output { stdout {} }'
Compiled pipeline code:
@inputs = []
@filters = []
@outputs = []
@input_file_1 = plugin("input", "file", LogStash::Util.hash_merge_many({ "path" => ("/tmp/thingy-for-logstash".force_encoding("UTF-8")) }, { "start_position" => ("beginning".force_encoding("UTF-8")) }, { "sincedb_path" => ("/dev/null".force_encoding("UTF-8")) }))
@inputs << @input_file_1
@output_stdout_2 = plugin("output", "stdout")
@outputs << @output_stdout_2
@filter_func = lambda do |event, &block|
extra_events = []
@logger.debug? && @logger.debug("filter received", :event => event.to_hash)
extra_events.each(&block)
end
@output_func = lambda do |event, &block|
@logger.debug? && @logger.debug("output received", :event => event.to_hash)
@output_stdout_2.handle(event)
end {:level=>:debug, :file=>"logstash/pipeline.rb", :line=>"26"}
Using milestone 2 input plugin 'file'. This plugin should be stable, but if you see strange behavior, please let us know! For more information on plugin milestones, see http://logstash.net/docs/1.4.1/plugin-milestones {:level=>:warn, :file=>"logstash/config/mixin.rb", :line=>"209"}
config LogStash::Codecs::Plain/@charset = "UTF-8" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@path = ["/tmp/thingy-for-logstash"] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@start_position = "beginning" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@sincedb_path = "/dev/null" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@debug = false {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@codec = <LogStash::Codecs::Plain charset=>"UTF-8"> {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@add_field = {} {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@stat_interval = 1 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@discover_interval = 15 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Inputs::File/@sincedb_write_interval = 15 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Codecs::Line/@charset = "UTF-8" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Outputs::Stdout/@type = "" {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Outputs::Stdout/@tags = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Outputs::Stdout/@exclude_tags = [] {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Outputs::Stdout/@codec = <LogStash::Codecs::Line charset=>"UTF-8"> {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
config LogStash::Outputs::Stdout/@workers = 1 {:level=>:debug, :file=>"logstash/config/mixin.rb", :line=>"105"}
Registering file input {:path=>["/tmp/thingy-for-logstash"], :level=>:info, :file=>"logstash/inputs/file.rb", :line=>"74"}
Pipeline started {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"78"}
_sincedb_open: reading from /dev/null {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"199"}
_discover_file_glob: /tmp/thingy-for-logstash: glob is: [] {:level=>:debug, :file=>"filewatch/watch.rb", :line=>"117"}
_discover_file_glob: /tmp/thingy-for-logstash: glob is: [] {:level=>:debug, :file=>"filewatch/watch.rb", :line=>"117"}
...time passes, above line repeats...
...hit CTRL-C...
^CInterrupt received. Shutting down the pipeline. {:level=>:warn, :file=>"logstash/agent.rb", :line=>"119"}
Sending shutdown signal to input thread {:thread=>#<Thread:0x285cc379 sleep>, :level=>:info, :file=>"logstash/pipeline.rb", :line=>"236"}
caller requested sincedb write () {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"185"}
caller requested sincedb write () {:level=>:debug, :file=>"filewatch/tail.rb", :line=>"185"}
Plugin is finished {:plugin=><LogStash::Outputs::Stdout >, :level=>:info, :file=>"logstash/plugin.rb", :line=>"59"}
Pipeline shutdown complete. {:level=>:info, :file=>"logstash/pipeline.rb", :line=>"89"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment