I'm running logstash from a bash script. I have the following input section :
input {
file {
path => "/home/pxg110/logstash/mach/test.csv"
start_position => "end"
sincedb_path => "/dev/null"
close_older => 1
}
}
I want logstash to time out after 1 second according to the online docs shown below.
What do I need to do to get this to time out properly.
The file input closes any files that were last read the specified timespan in seconds ago. This has different implications depending on if a file is being tailed or read. If tailing, and there is a large time gap in incoming data the file can be closed (allowing other files to be opened) but will be queued for reopening when new data is detected. If reading, the file will be closed after closed_older seconds from when the last bytes were read. The default is 1 hour
Why are you disabling the sincedb functionality? I am not sure what you are looking to achieve with this configuration - could you please elaborate a bit more?
The behaviour that I need is for logstash to exit once it has processed all bytes reading from the beginning to the end the file as specified by the file . As logstash is invoked from a bash script it cannot wait until more data comes in.
From the documentation I read and copied in my submission, when you set it to read from the beginning of the file, it will exit after the number of seconds specified has elapsed.
If this not possible, I would need to have logstash monitor a folder for changing content and have it process the file once it its submitted.
If you have examples, that would be great.
PS: the /dev/null was used in an example to disable the creation of a sincdb file that keeps track where logstash is while processing a file. This si used in case of failure so it knows where to restart.
Christian
I searched and found a post by Marcus suggesting the use of the stdin plugin and piping data into logstash. Just tried it and it works like I need it to work.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.