Splunk Search

join question

mark_chuman
Path Finder

here is my search - | dbquery "TQOMA" "SELECT "System", "%busy" FROM TQSTDBO.CPUVMSUM where "System" LIKE '%ntx%'"

basically, this returns a result for each system every sampling period. So, what I have is one line that represents all the samplings. I'd like to have a line for each system, but can't figure out how to do this. I was thinking something like this, but doesn't seem to work.

join System [| dbquery "TQOMA" "SELECT "System", "%busy" FROM TQSTDBO.CPUVMSUM where "System" LIKE '%ntx%'"]

Thanks for any feedback!

Tags (2)
0 Karma
1 Solution

mark_chuman
Path Finder

I got it.

| dbquery "TQOMA" "SELECT "Time", "System", "%busy" FROM TQSTDBO.CPUVMSUM where "System" LIKE '%ntx%'" | eval _time=Time | timechart avg(%busy) by System

View solution in original post

0 Karma

muebel
SplunkTrust
SplunkTrust

Hi Mark, I believe you will want to use the dbquery command to get your initial events, and then pipe it to stats values to get the set of %busy by system. Like so:

| dbquery "TQOMA" "SELECT "System", "%busy" FROM TQSTDBO.CPUVMSUM where "System" LIKE '%ntx%'" | stats values(%busy) by System

Or at least, something along those lines. Join is used to make a table with two data sets, joining on a particular common field, which I don't think is exactly what you are after in this case.

Please let me know if this helps!

0 Karma

mark_chuman
Path Finder

I got it.

| dbquery "TQOMA" "SELECT "Time", "System", "%busy" FROM TQSTDBO.CPUVMSUM where "System" LIKE '%ntx%'" | eval _time=Time | timechart avg(%busy) by System

0 Karma

somesoni2
Revered Legend

By "what I have is one line that represents all the samplings. I'd like to have a line for each system", do you mean in chart you're getting one line for overall %busy and you want to have a separate line for each System?

Can you provide some sample data as well? I don't think you need join here (join anyways is used to join two result sets, all I see it one single result set).

0 Karma
Get Updates on the Splunk Community!

Splunk + ThousandEyes: Correlate frontend, app, and network data to troubleshoot ...

 Are you tired of troubleshooting delays caused by siloed frontend, application, and network data? We've got a ...

Splunk Observability for AI

Don’t miss out on an exciting Tech Talk on Splunk Observability for AI!Discover how Splunk’s agentic AI ...

🔐 Trust at Every Hop: How mTLS in Splunk Enterprise 10.0 Makes Security Simpler

From Idea to Implementation: Why Splunk Built mTLS into Splunk Enterprise 10.0  mTLS wasn’t just a checkbox ...