# Display log in a given format

**URL:** <https://discuss.elastic.co/t/display-log-in-a-given-format/89294>\
**Category:** Logstash\
**Created:** [June 14, 2017, 5:00am UTC](https://discuss.elastic.co/t/display-log-in-a-given-format/89294 "2017-06-14T05:00:19Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![deepika](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@deepika](https://discuss.elastic.co/u/deepika)\
**Post date:** [June 14, 2017, 5:00am UTC](https://discuss.elastic.co/t/display-log-in-a-given-format/89294/1 "2017-06-14T05:00:19Z")

</div>

Hello,

I put the below code to group lines which start with "START" tag:

codec =\> multiline {  
pattern =\> "^START"  
negate =\> true  
what =\> previous  
auto\_flush\_interval =\> 1  
}

but i want to group line only which comes between each start and end. For example:

START  
INFO: NOTIFICATION\_ID,NOTIFICATION\_TYPE  
Web Serivce call  
END  
unwanted text  
START  
INFO: NOTIFICATION\_order  
Web Serivce another call  
END

In the above example i want to remove the "unwanted text" line because it doesn't come between "START" and "END"  
The output should be like:

Message 1:  
NFO: NOTIFICATION\_ID,NOTIFICATION\_TYPE  
Web Serivce call

Message 2:  
INFO: NOTIFICATION\_order  
Web Serivce another call

Request you to please help me.

Regards,  
Deepika

---

<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:** [June 14, 2017, 5:36am UTC](https://discuss.elastic.co/t/display-log-in-a-given-format/89294/2 "2017-06-14T05:36:42Z")

</div>

Perhaps you can use your current multiline configuration but use a grok filter or a mutate filter's gsub option to remove "\nEND\n" and everything that follows?

---

<div class="post-metadata">

**Author:** ![deepika](https://avatars.discourse-cdn.com/v4/letter/d/a587f6/32.png) [@deepika](https://discuss.elastic.co/u/deepika)\
**Post date:** [June 14, 2017, 6:00am UTC](https://discuss.elastic.co/t/display-log-in-a-given-format/89294/3 "2017-06-14T06:00:18Z")

</div>

Thanks !!  
But i am not able to use grok .  
Everytime it gives the error. can you pls give me one example

---

<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:** [June 14, 2017, 6:12am UTC](https://discuss.elastic.co/t/display-log-in-a-given-format/89294/4 "2017-06-14T06:12:14Z")

</div>

There are thousands of grok examples out there, including in the plugin's documentation. But I actually think gsub is better in this case, so you can try

```nohighlight
mutate {
  gsub => ["message", "\nEND\n.*", ""]
}

```

but I suspect that it won't work since `\n` isn't properly interpreted as a newline character. Using `\s` should work but could lead to false positives since it matches all whitespace characters.

---

<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 12, 2017, 6:12am UTC](https://discuss.elastic.co/t/display-log-in-a-given-format/89294/5 "2017-07-12T06:12:18Z")

</div>

Closed on July 12, 2017, 6:12am UTC

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