Splunk Search

Splunk Query with complex join and groupBy

ma_anand1984
Contributor

Events type

name, subtype, type, sal

EVENT sample

jack,male,human, 1000

rose,female,human,1500

I want to get the below output. Can someone help?

               Name    Salary
Human(male)    Jack     1000
Human(female)  Rose      1500

0 Karma
1 Solution

kristian_kolb
Ultra Champion

Assuming that the CSV fields are known to Splunk in the manner you state;

...| eval full_type = type . "(" . subtype . ")" | table full_type, name, sal

As you can see, this is a quite simple operation (just doing some string manipulation, and then tabulating it). Like jonuwz and Ayn says, please provide more complex data, if this solution is not good enough.

Hope this helps,

Kristian

View solution in original post

0 Karma

kristian_kolb
Ultra Champion

Assuming that the CSV fields are known to Splunk in the manner you state;

...| eval full_type = type . "(" . subtype . ")" | table full_type, name, sal

As you can see, this is a quite simple operation (just doing some string manipulation, and then tabulating it). Like jonuwz and Ayn says, please provide more complex data, if this solution is not good enough.

Hope this helps,

Kristian

0 Karma

Ayn
Legend

Please show us what the desired output would be in that more complex scenario.

0 Karma

ma_anand1984
Contributor

my event is CSV and i want output in a table. Yes please assume that there are more events with multiple types and sub types

0 Karma

jonuwz
Influencer

The sample output you require is just reformatting the event data you already have - there's no joins or group by.

Perhaps you could give a sample output when there is more than one of human(male) and/or more than one of human(female)

0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...