# Droping log when missing time entry

**URL:** <https://discuss.elastic.co/t/droping-log-when-missing-time-entry/255521>\
**Category:** Logstash\
**Created:** [November 16, 2020, 12:08pm UTC](https://discuss.elastic.co/t/droping-log-when-missing-time-entry/255521 "2020-11-16T12:08:13Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![iccMe](https://avatars.discourse-cdn.com/v4/letter/i/ba8739/32.png) [@iccMe](https://discuss.elastic.co/u/iccMe)\
**Post date:** [November 16, 2020, 12:08pm UTC](https://discuss.elastic.co/t/droping-log-when-missing-time-entry/255521/1 "2020-11-16T12:08:13Z")

</div>

Hi,

I was wondering if anyone could advise the best way to drop a log when the actual time is missing from the logged event. Normally the majority of the logs look like:

`[19/10/2020 00:00:01] servername - Processor Queue	Ok	0	WMI (localhost:ProcessorQueueLength)	3949`

however there is some entries that look like:

`[19/10/2020] servername - Processor Queue	Ok	0	WMI (localhost:ProcessorQueueLength)	3935`

My grok pattern is still able to match and filter the message, but I get a \_dateparsefailure tag added in Kibana due to the time being missing. How could I get logstash to drop any event that is missing the time? Below is the grok example I would use for the logs above, however the missing time is not unique to that type of event.

```
grok {
			match => { "message" => "%{SYSLOG5424SD:Time}%{SPACE}%{HOSTNAME:hostname} - (?<event>[^\t]*)%{SPACE}%{WORD:status}%{SPACE}%{NUMBER:reply}%{SPACE}%{GREEDYDATA:drop}" }
	}

```

thanks

Ian

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [November 16, 2020, 3:02pm UTC](https://discuss.elastic.co/t/droping-log-when-missing-time-entry/255521/2 "2020-11-16T15:02:09Z")

</div>

If you want to drop events that have a \_dateparsefailure tag then you could use

```
if "_dateparsefailure" in [tags] { drop {} }
```

---

<div class="post-metadata">

**Author:** ![iccMe](https://avatars.discourse-cdn.com/v4/letter/i/ba8739/32.png) [@iccMe](https://discuss.elastic.co/u/iccMe)\
**Post date:** [November 16, 2020, 3:10pm UTC](https://discuss.elastic.co/t/droping-log-when-missing-time-entry/255521/3 "2020-11-16T15:10:42Z")

</div>

Hi @Badger,

I should have said I tried that, but it seems to ignore that condition.

---

<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:10pm UTC](https://discuss.elastic.co/t/droping-log-when-missing-time-entry/255521/4 "2020-12-14T15:10:48Z")

</div>

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