Splunk Search

How to add the values of a column and show the result as a separate field?

Builder

Hello Expebrts,

I am trying to add the values of a column and show the result in another field, but I am not able to generate it.

Example:

index=abc |stats count by name 

Current Output:
areq 4
a
resp 2
breq 5
b
resp 5

Desired Output:
a 6

b 10

It should add areq and aresp and show a result in new column with the aggregate values

Tags (4)
0 Karma
1 Solution

SplunkTrust
SplunkTrust

The current search is counting name. If you want to count by a different field, you have to specify that field (and create it, if necessary). Try this:

index=abc | rex field=name "(?<aggrName>\w+)_" | stats count by aggrName
---
If this reply helps you, an upvote would be appreciated.

View solution in original post

SplunkTrust
SplunkTrust

The current search is counting name. If you want to count by a different field, you have to specify that field (and create it, if necessary). Try this:

index=abc | rex field=name "(?<aggrName>\w+)_" | stats count by aggrName
---
If this reply helps you, an upvote would be appreciated.

View solution in original post

Builder

Thanks richgalloway

0 Karma