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!

Enterprise Security Content Update (ESCU) | New Releases

In the last month, the Splunk Threat Research Team (STRT) has had 2 releases of new security content via the ...

Announcing the 1st Round Champion’s Tribute Winners of the Great Resilience Quest

We are happy to announce the 20 lucky questers who are selected to be the first round of Champion's Tribute ...

We’ve Got Education Validation!

Are you feeling it? All the career-boosting benefits of up-skilling with Splunk? It’s not just a feeling, it's ...