JOIN GRAYLOG FOR OUR

ANNUAL CONFERENCE

Thursday,
October 21, 2021
10am-5pm CT
REGISTER NOW

How to sum two field values from two different events together

Hi everyone,

Let’s take two different events from a common stream. Both of the events have a field called “TotalSessionLength”. My purpose is quiet simple: I would like to sum the different values I have for each events, and put the result into a variable.

Ex:
Event 1 : TotalSessionLength = 15
Event 2 : TotalSessionLength = 12

MyVariable = 15 + 12

I thought I could do it simply by using a rule but it looks like the rule can’t be performed on several events simultaneously.

Does anyone know how to figure out my problem? Thank you in advance.

Regards,

Clem.

You can look at storing values in Mongodb…

https://docs.graylog.org/en/4.0/pages/pipelines/functions.html#lookup-set-value

Hi @tmacgbay ,
Thank you for your answer. I will check if it can work. Does it require any Graylog sidecar or extension?

Regards,

Clem.

These MongoDB functions happen after the message arrives in Graylog. You are required to have an enterprise license to use these particular functions (according to docs) If data is consistently under 5GB a day that shouldn’t be an issue as you can apply for a free license.

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