# Multiline grepping

**URL:** <https://discuss.elastic.co/t/multiline-grepping/199027>\
**Category:** Logstash\
**Created:** [September 11, 2019, 7:25am UTC](https://discuss.elastic.co/t/multiline-grepping/199027 "2019-09-11T07:25:47Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![satyam2593](https://avatars.discourse-cdn.com/v4/letter/s/a88e4f/32.png) [@satyam2593](https://discuss.elastic.co/u/satyam2593)\
**Post date:** [September 11, 2019, 7:25am UTC](https://discuss.elastic.co/t/multiline-grepping/199027/1 "2019-09-11T07:25:47Z")

</div>

i want to grep the multilines from the logs. and am using multiline codec in my config file.. Below are the sample pattern and config file

sample logs:  
--------------------------------------  
17 Jul 2019 00:15:00,403 | INFO | Thread-186940 | net.sf.json.xml.XMLSerializer 736 | 1050 - hermes.NMX\_AlarmInfo\_GetKPI - 1.2.0 | Using default type string  
17 Jul 2019 00:15:00,404 | INFO | 970074601-766148 | eptor.AbstractLoggingInterceptor 276 | 38 - org.apache.cxf.cxf-core - 3.2.4 | Outbound Message  
---------------------------  
ID: 714439  
Response-Code: 200  
Content-Type: application/xml  
Headers: {Content-Type=[application/xml], Date=[Tue, 16 Jul 2019 23:15:00 GMT]}  
Payload: [{"period\_start\_time":"2019-07-07 16:00:00","rnc":"236","site\_id":"42596","cell\_id":"42596E6","kpi\_value":"0.00000000000000000000"},{"period\_start\_time":"2019-07-07  
--------------------------------------

In the above logs, i want to grep everything except the below line.

"17 Jul 2019 00:15:00,403 | INFO | Thread-186940 | net.sf.json.xml.XMLSerializer 736 | 1050 - hermes.NMX\_AlarmInfo\_GetKPI - 1.2.0 | Using default type string"

That means i need to grep the line which is having Inbound/outbound message as starting pattern and end with payload

Can any one help on this , how to skip the first line

My config file:  
input {  
file {  
path =\> "/etc/logstash/ESB1\_Request\_Response.log"  
sincedb\_path =\> "/dev/null"  
start\_position =\> "beginning"  
codec =\> multiline {  
pattern =\> "--------------------------------------"  
negate =\> true  
what =\> "previous"  
}  
}  
}

filter {  
mutate {  
gsub =\> [  
"message", "--------------------------------------\n", "",  
"message", "---------------------------\n", "",  
"message", '\n', "**",  
"message", '\n', "**",  
"message", '-ID:',"ID:"  
]  
}

---

<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:** [October 9, 2019, 7:25am UTC](https://discuss.elastic.co/t/multiline-grepping/199027/2 "2019-10-09T07:25:52Z")

</div>

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