Logstash to log file processing start and end time


I am trying to forward like 365 gzip historical data files to another log management tool through syslog output plugin and using file input with Read mode.
I need to track and log timestamp for every file when it started to processing and when it finishes in logstash.
I see some timestamp in the SinceDB but I am not sure I can rely on that as the timestamp for every file being updated frequently.

Is there anyway we can log this data from Logstash ?


What does your pipeline looks like?

You could add a field with the time in the beginning of your filter block and another field in the end of the filter block.

filter {
    mutate {
        add_field => { "startTime" => "%{yyyy.MM.dd HH:mm:ss}" } 
    *** your other filters ****
    mutate {
        add_field => { "endTime" => "%{yyyy.MM.dd HH:mm:ss}" } 

This will add those two fields in every event and give you the estimate time that the event spent in logstash.

Thanks for your response.
I don't need those fields in the event. I am looking to track them separately preferably in a file.

something like below would be good. first entry is when the file is stated processing and second one is once it is completed.

11/15/2020 00:00:00 c:\xx\xx.log
11/15/2020 02:05:00 c:\xx\xx.log

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