# Sum of occurrences in multi line log comes in one second

**URL:** <https://discuss.elastic.co/t/sum-of-occurrences-in-multi-line-log-comes-in-one-second/128161>\
**Category:** Logstash\
**Created:** [April 16, 2018, 10:06am UTC](https://discuss.elastic.co/t/sum-of-occurrences-in-multi-line-log-comes-in-one-second/128161 "2018-04-16T10:06:56Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![MateuszB](https://avatars.discourse-cdn.com/v4/letter/m/d07c76/32.png) [@MateuszB](https://discuss.elastic.co/u/MateuszB)\
**Post date:** [April 16, 2018, 10:06am UTC](https://discuss.elastic.co/t/sum-of-occurrences-in-multi-line-log-comes-in-one-second/128161/1 "2018-04-16T10:06:56Z")

</div>

Hi,  
I'd like to create a counter that adds another value ("1" or "one") to an existing string. If in my log there are 3 lines with the occurrence of the word 'low', then each time I will increase the variable value '1'. The value of my variable should look like "111".

My log file look like this and comes in one second:

> root: 192.168.1.10|unknown (66/tcp)|92567|Low|description|  
> root: 192.168.1.10|unknown (26/tcp)|92567|Low|description|  
> root: 192.168.1.10|unknown (56/tcp)|92567|Low|description|

my grok config:

> grok {  
> match =\> ["message", "%{IPV4:host\_ip}|%{DATA:protokol\_port}|%{NUMBER:nessus\_id}|%{WORD:threatlvl}|%{DATA:description}|"]  
> }

---

<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 14, 2018, 10:07am UTC](https://discuss.elastic.co/t/sum-of-occurrences-in-multi-line-log-comes-in-one-second/128161/2 "2018-05-14T10:07:15Z")

</div>

Closed on May 14, 2018, 10:07am UTC

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