Splunk Search

How do I get the max from each column?

HattrickNZ
Motivator

With a search like ....| eval Field3=Field1+Field3

I have data as follows(in the stats tab):

_time   Field1  Field2  Field3
2015-05-11 00:00    915.426122  698.086667  217.33945530
2015-05-11 01:00    593.966923  462.311111  131.65581163
2015-05-11 02:00    403.424360  319.715556  83.708804253
2015-05-11 03:00    327.785973  261.006667  66.779305556 
.
.
.

how do I get the max of each column?

I am thinking something like addcoltotalsbut that gets the sum of the columns but I want the max.

Labels (1)
Tags (2)
0 Karma
1 Solution

MuS
SplunkTrust
SplunkTrust

Hi HattrickNZ,

how about something like this:

.... | eval Field1=Field2+Field3 | stats max(Field1) AS Field1 max(Field2) AS Field2 max(Field3) AS Field3 by _time

It looks like you're adding up Field2 + Field3 so I changed it in above search.

Hope this helps ....

cheers, MuS

View solution in original post

jotne
Builder

If you have may fields and do not know the name of them or variable number of fields, you can run it like this:

| stats max(*) as max_*
0 Karma

MuS
SplunkTrust
SplunkTrust

Hi HattrickNZ,

how about something like this:

.... | eval Field1=Field2+Field3 | stats max(Field1) AS Field1 max(Field2) AS Field2 max(Field3) AS Field3 by _time

It looks like you're adding up Field2 + Field3 so I changed it in above search.

Hope this helps ....

cheers, MuS

HattrickNZ
Motivator

easy as that, tks.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

April 2026 Edition  Hayyy Splunk Education Enthusiasts and the Eternally Curious!   We’re back with this ...

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...