# Logstash to log file processing start and end time

**URL:** https://discuss.elastic.co/t/logstash-to-log-file-processing-start-and-end-time/255462
**Category:** Logstash
**Created:** [November 16, 2020, 2:27am UTC](https://discuss.elastic.co/t/logstash-to-log-file-processing-start-and-end-time/255462 "2020-11-16T02:27:09Z")
**Posts on this page:** 4
**Page:** 1

<div class="post-metadata">

### Author: ![sam281](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sam281](https://discuss.elastic.co/u/sam281)
#### Post date: [November 16, 2020, 2:27am UTC](https://discuss.elastic.co/t/logstash-to-log-file-processing-start-and-end-time/255462/1 "2020-11-16T02:27:09Z")

</div>

Hello,

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 ?

Thanks

---

<div class="post-metadata">

### Author: ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)
#### Post date: [November 16, 2020, 3:28am UTC](https://discuss.elastic.co/t/logstash-to-log-file-processing-start-and-end-time/255462/2 "2020-11-16T03:28:33Z")

</div>

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.

```auto
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.

---

<div class="post-metadata">

### Author: ![sam281](https://avatars.discourse-cdn.com/v4/letter/s/d78d45/32.png) [@sam281](https://discuss.elastic.co/u/sam281)
#### Post date: [November 16, 2020, 3:59am UTC](https://discuss.elastic.co/t/logstash-to-log-file-processing-start-and-end-time/255462/3 "2020-11-16T03:59:41Z")

</div>

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

---

<div class="post-metadata">

### Author: ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)
#### Post date: [December 14, 2020, 3:59am UTC](https://discuss.elastic.co/t/logstash-to-log-file-processing-start-and-end-time/255462/4 "2020-12-14T03:59:53Z")

</div>

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