Splunk Search

How to calculate row sum which each column has different weight?

hakusama1024
New Member

Hi

I have a table as below.

severity S0 S1 S2 S3
event A 1 0 0 0
event B 0 2 0 0
event C 0 1 1 0

each column has different weight. for example S0 = 1,000,000, S1 = 10,000, S2 = 100, S3 = 1. i want to sort the event based on the weight multiply by the event number.
Please advise.

Tags (3)
0 Karma
1 Solution

HeinzWaescher
Motivator

try this:

| eval weight=(S0*1000000 + S1*10000 + S2*100 + S3*1)
| sort 0 - weight

View solution in original post

HeinzWaescher
Motivator

try this:

| eval weight=(S0*1000000 + S1*10000 + S2*100 + S3*1)
| sort 0 - weight

hakusama1024
New Member

thank you sir.

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 ...