# To grok or not to grok?

**URL:** <https://discuss.elastic.co/t/to-grok-or-not-to-grok/158926>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [November 30, 2018, 3:17pm UTC](https://discuss.elastic.co/t/to-grok-or-not-to-grok/158926 "2018-11-30T15:17:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![jdswifty](https://avatars.discourse-cdn.com/v4/letter/j/779978/32.png) [@jdswifty](https://discuss.elastic.co/u/jdswifty)\
**Post date:** [November 30, 2018, 3:17pm UTC](https://discuss.elastic.co/t/to-grok-or-not-to-grok/158926/1 "2018-11-30T15:17:55Z")

</div>

Hi  
Looking for some advice from the elastic community  
I need to parse the following log entry into separate fields.  
My initial thoughts were to try & write a grok pattern as the structure is the same for each log entry but wondering if there was a better way as the source logs are in XML format

```
<m n="-1" p="Unknown" c="-1" d="10:20:28.161" u="-1" t="LiveNode" i="-1.1" s="70">
org.springframework.ldap.CommunicationException: xxxxxxxx:636; nested exception is javax.naming.CommunicationException: xxxxxxxxxx:636 [Root exception is javax.net.ssl.SSLHandshakeException: sun.security.validator.ValidatorException: PKIX path building failed: sun.security.provider.certpath.SunCertPathBuilderException: unable to find valid certification path to requested target]
	at org.springframework.ldap.support.LdapUtils.convertLdapException(LdapUtils.java:100)
	at org.springframework.ldap.core.support.AbstractContextSource.createContext(AbstractContextSource.java:266)
	at org.springframework.ldap.core.support.AbstractContextSource.getContext(AbstractContextSource.java:106)
	at org.springframework.ldap.core.support.AbstractContextSource.getReadWriteContext(AbstractContextSource.java:138)
</m>
```

---

<div class="post-metadata">

**Author:** ![steffens](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/steffens/32/79630_2.png) [@steffens](https://discuss.elastic.co/u/steffens)\
**Post date:** [December 3, 2018, 10:28pm UTC](https://discuss.elastic.co/t/to-grok-or-not-to-grok/158926/2 "2018-12-03T22:28:46Z")

</div>

Looks like you need to enable multiline support. Logstash also has an [XML filter](https://www.elastic.co/guide/en/logstash/current/plugins-filters-xml.html). Personally I'd always prefer a proper parser over grok (which is based on regular expression).

---

<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 31, 2018, 10:28pm UTC](https://discuss.elastic.co/t/to-grok-or-not-to-grok/158926/3 "2018-12-31T22:28:47Z")

</div>

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