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!

.conf24 | Registration Open!

Hello, hello! I come bearing good news: Registration for .conf24 is now open!   conf is Splunk’s rad annual ...

ICYMI - Check out the latest releases of Splunk Edge Processor

Splunk is pleased to announce the latest enhancements to Splunk Edge Processor.  HEC Receiver authorization ...

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...