# Can logstash log event when parsing error?

**URL:** <https://discuss.elastic.co/t/can-logstash-log-event-when-parsing-error/45410>\
**Category:** Logstash\
**Created:** [March 25, 2016, 2:32am UTC](https://discuss.elastic.co/t/can-logstash-log-event-when-parsing-error/45410 "2016-03-25T02:32:29Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![okwap](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/okwap/32/572_2.png) [@okwap](https://discuss.elastic.co/u/okwap)\
**Post date:** [March 25, 2016, 2:32am UTC](https://discuss.elastic.co/t/can-logstash-log-event-when-parsing-error/45410/1 "2016-03-25T02:32:29Z")

</div>

Hi all,

To explain my question, assume the following scenario:

I use logstash to handle huge logs, and I notice that /var/log/logstash/logstash.log has an parsing error message:

```auto
{:timestamp=>"2016-03-25T10:00:21.365000", :message=>"Failed parsing date from field", :field=>"Timestamp", :value=>"727;%20.NET%20CLR%203.5.30729;%20.NET%20CLR%203.0.30729;%20Media%20Center%20PC%206.0;%20.NET4.0E;%20.NET4.0C)", :exception=>"Invalid format: \"727;%20.NET%20CLR%203.5.30729;%20.N...\" is malformed at \";%20.NET%20CLR%203.5.30729;%20.N...\"", :config_parsers=>"YYYYMMddHHmmss", :config_locale=>"default=en_US", :level=>:warn}

```

But I cannot figure out what's wrong with my log from above message. If Iogstash can log full event content when error occurred, then I can figure out the problem or do more tests.

So, my question is: can logstash record content of event when parsing error? Or there is any better approach to debug parsing error in production environment? Thanks.

---

<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:** [March 25, 2016, 10:15am UTC](https://discuss.elastic.co/t/can-logstash-log-event-when-parsing-error/45410/2 "2016-03-25T10:15:25Z")

</div>

When the date filter can't parse a field it'll add the `_dateparsefailure` tag to the event. You can emit those messages to a separate logfile or to Logstash's regular log, e.g. like this:

```auto
output {
  if "_dateparsefailure" in [tags] {
    file {
      path => "/var/log/logstash/dateparsefailure.log"
      codec => json_lines
    }
  }
}

```

---

<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, 5:05am UTC](https://discuss.elastic.co/t/can-logstash-log-event-when-parsing-error/45410/3 "2017-07-06T05:05:24Z")

</div>


