# Add fields with same format but different value problem with grok logstash

**URL:** <https://discuss.elastic.co/t/add-fields-with-same-format-but-different-value-problem-with-grok-logstash/298043>\
**Category:** Logstash\
**Created:** [February 23, 2022, 1:33pm UTC](https://discuss.elastic.co/t/add-fields-with-same-format-but-different-value-problem-with-grok-logstash/298043 "2022-02-23T13:33:19Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![alex\_vermex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_vermex/32/101267_2.png) [@alex\_vermex](https://discuss.elastic.co/u/alex_vermex)\
**Post date:** [February 23, 2022, 1:33pm UTC](https://discuss.elastic.co/t/add-fields-with-same-format-but-different-value-problem-with-grok-logstash/298043/1 "2022-02-23T13:33:20Z")

</div>

Hi,  
log file example:

```auto
2021-01-01 11:15:02 - it is a f....
2021-01-01 11:15:04 - format is => 
000000: 00 11 22 a5 12 12 23 2a 55 12 00 22 33 44 | ?1451202000
.
.
.
00114: 00 11 55 77 9a 11 0
2021-12-23 10:14:22 - testing request
2021-12-23 10:17:01 - format is => 
000000: 01 02 3d 5d 79 11 00 .... | s9.kk6400
.
.
.
000144: 69 69 66 33 22 11 44 7d .... | 22 s6 66700
2021-12-23 10:17:01 - testing request

```

So I want to add a field when I found "format is" which was in the same message because I made the multiline in filebeat.yml  
so tried this:

```auto
if ("format is" in [message]) {
        grok { match => { "message" => "(?<format>(^\d{4}-\d{2}-\d{2}\s\d{2}:\d{2}:\d{2}\s{3}-\sformat\sis\s\S{2}\s(\n))(^\d{6}:[^(\r\n)]*(\n)*)+)" }}
    }

```

It just gives me the first block ignores me the second and I want both of them each in a field

Any help would be sincerely appreciate!  
Thanks!

---

<div class="post-metadata">

**Author:** ![alex\_vermex](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/alex_vermex/32/101267_2.png) [@alex\_vermex](https://discuss.elastic.co/u/alex_vermex)\
**Post date:** [February 23, 2022, 7:51pm UTC](https://discuss.elastic.co/t/add-fields-with-same-format-but-different-value-problem-with-grok-logstash/298043/2 "2022-02-23T19:51:31Z")

</div>

I don't know if it's possible any solution please?

---

<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:** [March 23, 2022, 7:51pm UTC](https://discuss.elastic.co/t/add-fields-with-same-format-but-different-value-problem-with-grok-logstash/298043/3 "2022-03-23T19:51:42Z")

</div>

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