Splunk Search

need to use Group By here in my result

shivareddysompa
Explorer

my data Name spent income
A 10 20
B 20 40
C 30 60
A 40 80
B 50 100
Outcome have to come

        Name  spent income
        A   50  100
        B   70  140
        C   30  60
Tags (1)
0 Karma

shivareddysompa
Explorer

not working

0 Karma

to4kawa
Ultra Champion

not working

If you want to solve the problem, you have to talk about the situation or no one will know.

| makeresults 
| eval _raw="Name,spent,income
A,10,20
B,20,40
C,30,60
A,40,80
B,50,100" 
| multikv forceheader=1 
| table Name,spent,income 
| stats sum(spent) as spent sum(income) as income by Name

results

Name    spent   income
A   50  100
B   70  140
C   30  60
0 Karma

493669
Super Champion

It is working for me -

|makeresults|eval Name="A", spent="20", income=30
|append[|makeresults|eval Name="B", spent=20, income=40]
|append[|makeresults|eval Name="A", spent=40, income=80]
|stats sum(spent) as spent sum(income) as income by Name

please share your sample code.

0 Karma

isoutamo
SplunkTrust
SplunkTrust

Hi

You can check relevant spl vs sql from here:
https://docs.splunk.com/Documentation/SplunkCloud/8.0.2003/SearchReference/SQLtoSplunk

R. Ismo

0 Karma

493669
Super Champion

@shivareddysompalle,
try below-

...|stats sum(spent) as spent sum(income) as income by Name
0 Karma
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...