Splunk Search

getting sum of a multivalues field for ach event

vijaya5
Engager

Hi,

I have a query like below.

index=linux sourcetype=iostat mount="*"
which will list total_ops for each mount of a host in multiple events.

i need to get sum of total_ops of each host of all mounts from latest event.

Please help

0 Karma
1 Solution

codebuilder
SplunkTrust
SplunkTrust

Try this:

index=linux sourcetype=iostat mount="*" | mvexpand total_ops

That will break the multivalue field into separate events. Then you can add your stats, etc.
Worth noting, you can only use mvexpand on a single field.

----
An upvote would be appreciated and Accept Solution if it helps!

View solution in original post

0 Karma

to4kawa
Ultra Champion
index=linux sourcetype=iostat mount="*"
| streamstats window=1 sum(total_ops) as total_ops
| stats sum(total_ops) as total_ops by mount host
0 Karma

codebuilder
SplunkTrust
SplunkTrust

Try this:

index=linux sourcetype=iostat mount="*" | mvexpand total_ops

That will break the multivalue field into separate events. Then you can add your stats, etc.
Worth noting, you can only use mvexpand on a single field.

----
An upvote would be appreciated and Accept Solution if it helps!
0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...