# Extract time stamp from the log data

**URL:** <https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917>\
**Category:** Logstash\
**Created:** [June 15, 2016, 8:20pm UTC](https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917 "2016-06-15T20:20:53Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![Sri\_ram](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Sri\_ram](https://discuss.elastic.co/u/Sri_ram)\
**Post date:** [June 15, 2016, 8:20pm UTC](https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917/1 "2016-06-15T20:20:53Z")

</div>

Hello,

I am trying to extract the time stamp from the header of log data. Here is my log data looks like:

* * *

## Page: 1 Active Internet connections Report: Total ( 223) Time: Mon Mar 17 00:14:32 EST 2014 Proto |RefCnt |Type |State

unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |3 |STREAM |CONNECTED  
unix |2 |DGRAM |

As an output i only need time field [Time: Mon Mar 17 00:14:32 EST 2014] from header and to extract metrics i can use grok filter. Any ideas would be helpful

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 17, 2016, 5:44am UTC](https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917/2 "2016-06-17T05:44:49Z")

</div>

You mean you want to pick up the timestamp from the header line and apply that timestamp to all subsequent events? I don't believe there's a Logstash plugin that helps you with this.

---

<div class="post-metadata">

**Author:** ![Sri\_ram](https://avatars.discourse-cdn.com/v4/letter/s/3da27b/32.png) [@Sri\_ram](https://discuss.elastic.co/u/Sri_ram)\
**Post date:** [June 17, 2016, 2:52pm UTC](https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917/3 "2016-06-17T14:52:46Z")

</div>

I need a time stamp from the header and would like to process the subsequent events with that time stamp.

The Time field from header [Time: Mon Mar 17 00:14:32 EST 2014] should replace the "@timestamp" field, and all the subsequent events under the header should have the same @timestamp while processing the event.

For ex, the output should look like :  
"@timestamp" =\> "2014-03-17T12:14:32:000Z"  
"proto" =\> "unix"  
"RefCnt" =\> "3"  
"Type" =\> "STREAM"  
"State" =\> "CONNECTED" [and then for the second event also it should have the same @timestamp]

"@timestamp" =\> "2014-03-17T12:14:32:000Z"  
"proto" =\> "unix"  
"RefCnt" =\> "2"  
"Type" =\> "DGRAM"

---

<div class="post-metadata">

**Author:** ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)\
**Post date:** [June 17, 2016, 5:33pm UTC](https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917/4 "2016-06-17T17:33:16Z")

</div>

Right. Then my previous answer stands; there's no standard plugin to help out with this.

---

<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:** [July 6, 2017, 4:52am UTC](https://discuss.elastic.co/t/extract-time-stamp-from-the-log-data/52917/5 "2017-07-06T04:52:10Z")

</div>


