# Assume the date is current date if there is no date in log

**URL:** https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599
**Category:** Logstash
**Created:** [November 10, 2016, 7:54am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599 "2016-11-10T07:54:24Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![alex88](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@alex88](https://discuss.elastic.co/u/alex88)
#### Post date: [November 10, 2016, 7:54am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599/1 "2016-11-10T07:54:24Z")

</div>

I have log:  
08:42:21.706 [qtp1335954408-120] DEBUG i.s.client.http.JestHttpClient - POST method created based

It contains just time I need to add month and day . How can i do it with logstash filters?

---

<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: [November 10, 2016, 8:26am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599/2 "2016-11-10T08:26:38Z")

</div>

You'll have to use a ruby filter for this. Use Ruby's standard date and time functions to add the date in the field where you currently have the time

---

<div class="post-metadata">

### Author: ![alex88](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@alex88](https://discuss.elastic.co/u/alex88)
#### Post date: [November 10, 2016, 8:55am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599/3 "2016-11-10T08:55:03Z")

</div>

Can you please provide some example?

---

<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: [November 10, 2016, 9:27am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599/4 "2016-11-10T09:27:19Z")

</div>

What part are you having trouble with, specifically? There are plenty of ruby filter examples out there.

---

<div class="post-metadata">

### Author: ![alex88](https://avatars.discourse-cdn.com/v4/letter/a/eb8c5e/32.png) [@alex88](https://discuss.elastic.co/u/alex88)
#### Post date: [November 10, 2016, 10:17am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599/5 "2016-11-10T10:17:20Z")

</div>

I have grok filter to parse this log

if [type] == "neo4j" {  
grok {  
match =\> [  
"message", "%{TIMESTAMP\_ISO8601:timestamp} %{LOGLEVEL:severity} %{GREEDYDATA:message}",  
"message", "%{TIME:timestamp} %{SYSLOG5424SD:data} %{LOGLEVEL:severity} %{GREEDYDATA:message}" ]  
}  
}  
date {  
match =\> ["timestamp" , "dd/MMM/yyyy:HH:mm:ss Z"]  
}  
}

but I got only time (because log has only time) How I can add day and month here?  
thanks for reply magnusbaeck

---

<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 8, 2016, 10:17am UTC](https://discuss.elastic.co/t/assume-the-date-is-current-date-if-there-is-no-date-in-log/65599/6 "2016-12-08T10:17:34Z")

</div>

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