All Apps and Add-ons

dbxquery returns statistics instead of events for subquery

teknet9
Path Finder

Hello,

I want to:
- run a search for specific syslog messages
- filter out all those which have a corresponding field in mysql table column

I wanted to do subsearch like:
host="10.62.140.64" Field1 NOT []
and put inside [] my |dbxquery

But then noticed that dbxquery is not returning any events which could be used for subsearch but statistics only.
Can i use dbquery for subsearch ? (to filter out my main syslog search) ? Could you provide any example ?

Thanks,
Michal

Tags (1)
0 Karma

teknet9
Path Finder

Thank you Somesoni2,

It does not work for me. My final search:

host="10.62.140.64" CISE_Profiler EndpointMatchedPolicy=Workstation NOT [|dbxquery query="SELECT mac FROM endpoints.endpoints" connection="MYSQL" shortnames=true | fields - _* | rename mac as EndPointMACAddress | table EndPointMACAddress]

The first part: "host="10.62.140.64" CISE_Profiler EndpointMatchedPolicy=Workstation" is returning syslog message with "EndpointMacAddress=00:50:B6:11:EA:CE". The second part "|dbxquery query="SELECT mac FROM endpoints.endpoints" connection="MYSQL" shortnames=true | fields - _* | rename mac as EndPointMACAddress | table EndPointMACAddress" is returning the table with EndPointMACAddress column and one of the values is 00:50:B6:11:EA:CE.

Why is that happening ?
The search like this:
host="10.62.140.64" CISE_Profiler EndpointMatchedPolicy=Workstation NOT [00:50:B6:11:EA:CE] is working fine. So it is something wrong with dbxquery conjunction....

Thanks,
Michal

0 Karma

somesoni2
Revered Legend

Yes, the subsearch with dbxquery will be used as filter, so it shouldn't be returning events but the field that you want to use as filter. The syntax should be like this

host="10.62.140.64" NOT [|dbxquery...| table Field1 ]

This will get translated as this after subsearch has returned results

host="10.62.140.64" NOT (Field1="ValueFromdbxquery1" OR Field1="ValueFromdbxquery2"...)
0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Calling All Security Pros: Ready to Race Through Boston?

Hey Splunkers, .conf25 is heading to Boston and we’re kicking things off with something bold, competitive, and ...

Beyond Detection: How Splunk and Cisco Integrated Security Platforms Transform ...

Financial services organizations face an impossible equation: maintain 99.9% uptime for mission-critical ...

Customer success is front and center at .conf25

Hi Splunkers, If you are not able to be at .conf25 in person, you can still learn about all the latest news ...