Splunk Search

Is it possible to run subsearches with tstats alone?

yacht_rock
Explorer

Can you do subsearches with tstats alone?

   | tstats values(DM.app) AS App FROM datamodel=DM  BY DM.source [|
    tstats count FROM datamodel=DM WHERE DM.cat="foo" BY DM.dest |
    rename DM.dest AS DM.source |
    table DM.source ]

Source/dest are IPs - I want to get all the dest IPs of a certain server type (foo), then use those dest IPs as the source IPs for my main search.

The error that stops me is DM.source=1.2.3.4 (an IP address will show up here). I'm clearly missing something here and would appreciate any help.

Tags (2)
0 Karma
1 Solution

somesoni2
Revered Legend

Try like this

| tstats values(DM.app) AS App FROM datamodel=DM  BY DM.source | search  [|
     tstats count FROM datamodel=DM WHERE DM.cat="foo" BY DM.dest |
     rename DM.dest AS DM.source |
     table DM.source ]

View solution in original post

somesoni2
Revered Legend

Try like this

| tstats values(DM.app) AS App FROM datamodel=DM  BY DM.source | search  [|
     tstats count FROM datamodel=DM WHERE DM.cat="foo" BY DM.dest |
     rename DM.dest AS DM.source |
     table DM.source ]
Get Updates on the Splunk Community!

More Ways To Control Your Costs With Archived Metrics | Register for Tech Talk

Tuesday, May 14, 2024  |  11AM PT / 2PM ET Register to Attend Join us for this Tech Talk and learn how to ...

.conf24 | Personalize your .conf experience with Learning Paths!

Personalize your .conf24 Experience Learning paths allow you to level up your skill sets and dive deeper ...

Threat Hunting Unlocked: How to Uplevel Your Threat Hunting With the PEAK Framework ...

WATCH NOWAs AI starts tackling low level alerts, it's more critical than ever to uplevel your threat hunting ...