Splunk Search

Splunk query - update a field with first value of the field

ma_anand1984
Contributor

I'm trying to write a query that converts table 1 to table 2
Basically, i want to retain first value of flower for city-place combination for all rows

Any easiest way to do this?



table1
city   place  flower
NC     A        rose
NC     B        lily
NC     C        sunflower
DE     A        scarlet
DE     B        rose
DE     C        lily     

Table2
city   place  flower
NC     A        rose
NC     B        rose
NC     C        rose
DE     A        scarlet
DE     B        scarlet
DE     C        scarlet

Tags (4)
0 Karma
1 Solution

Ayn
Legend

You could probably use eventstats for this:

... | eventstats first(flower) as flower by city

View solution in original post

Ayn
Legend

You could probably use eventstats for this:

... | eventstats first(flower) as flower by city
Get Updates on the Splunk Community!

Index This | Forward, I’m heavy; backward, I’m not. What am I?

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

A Guide To Cloud Migration Success

As enterprises’ rapid expansion to the cloud continues, IT leaders are continuously looking for ways to focus ...

Join Us for Splunk University and Get Your Bootcamp Game On!

If you know, you know! Splunk University is the vibe this summer so register today for bootcamps galore ...