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!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

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

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...