All Apps and Add-ons

Splunk DB Connect 2: How to run same the same SQL query on multiple databases?

internet_team
Explorer

Hello,

I would like to run the same SQL query on many databases. First way I tried was to clone db inputs, but this is not efficient in case the SQL query changes (need to update each input).

Is there any easy way to run 1 SQL query on multiple databases?
Is it possible to set mySQL query on 1 text file, and specify this text file on query stanza ?

jtrimmings
Engager

How about

| dbxquery connection=databasecon1 query="select @@servername"

| union
[ dbxquery connection=databasecon2 query="select @@servername"]
| union
[dbxquery connection=yetanotherdb query="select@@servername"]

0 Karma

kyaparla
Path Finder

I have similar requirement, so I tried some like this and it worked for my requirement.

|rest /servicesNS/-/-/configs/conf-db_connections | stats count by title,host | search title="*" | map search="|dbxquery query=\" url encoded sql query\" connection=$title$ maxrows=100 | eval connection=\"$title$\" | eval dbhost=\"$host$\""

jcoates_splunk
Splunk Employee
Splunk Employee

Good question -- there isn't a way to do that (at least not one I can think of). Can you please open a support case so we can get an enhancement request and investigate further?

internet_team
Explorer

Hello, i did it. Hope it help ...

0 Karma
Get Updates on the Splunk Community!

Unlock Database Monitoring with Splunk Observability Cloud

  In today’s fast-paced digital landscape, even minor database slowdowns can disrupt user experiences and ...

Purpose in Action: How Splunk Is Helping Power an Inclusive Future for All

At Cisco, purpose isn’t a tagline—it’s a commitment. Cisco’s FY25 Purpose Report outlines how the company is ...

[Upcoming Webinar] Demo Day: Transforming IT Operations with Splunk

Join us for a live Demo Day at the Cisco Store on January 21st 10:00am - 11:00am PST In the fast-paced world ...