# Parsing multiple formats in the same log file

**URL:** https://discuss.elastic.co/t/parsing-multiple-formats-in-the-same-log-file/229377
**Category:** Logstash
**Created:** [April 23, 2020, 4:49am UTC](https://discuss.elastic.co/t/parsing-multiple-formats-in-the-same-log-file/229377 "2020-04-23T04:49:08Z")
**Posts on this page:** 2
**Page:** 1

<div class="post-metadata">

### Author: ![vikramaddagulla](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/vikramaddagulla/32/139858_2.png) [@vikramaddagulla](https://discuss.elastic.co/u/vikramaddagulla)
#### Post date: [April 23, 2020, 4:49am UTC](https://discuss.elastic.co/t/parsing-multiple-formats-in-the-same-log-file/229377/1 "2020-04-23T04:49:08Z")

</div>

Hello,

Is it possible to parse multiple formats in a single log file ?

For ex : My log file can write different type of data belonging to different sub-system within the same application which is writing the logs.

The first line of the log can be as below :

[composite\_name: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*] [composite\_version: 1.0] [endpoint\_name: \*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*\*] JMSMessageConsumer\_init:[destination = \*\*\*\*\*\*\*\* (payload = 1)]:Failed to create managed connection: java.lang.ClassCastException  
javax.resource.spi.ResourceAdapterInternalException: Failed to create managed connection: java.lang.ClassCastException

A few lines later, the log can be like below :

\<JCABinding=\> \*\*\*\*\*\*\*\*\*\*\*\*\*\* [\*\*\*\*\*\*\*\*\*\*\*::insert(\*\*\*\*\*\*\*)] Could not invoke operation 'insert' against the 'db' due to:  
BINDING.JCA-11616  
DBWriteInteractionSpec Execute Failed Exception.  
insert failed.

--\> Is it possible to parse such data within the same file ?  
--\> Is it possible to extract fields based on a keyword search??

For example :  
If a field has some specific data as part of huge stack like : "Caused by...\*\*\*\*"  
Then I would like to extract that specific line into another field

---

<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: [May 21, 2020, 4:49am UTC](https://discuss.elastic.co/t/parsing-multiple-formats-in-the-same-log-file/229377/2 "2020-05-21T04:49:08Z")

</div>

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