All Apps and Add-ons

dbquery Syntax Error

harshavrath
Contributor

Hi,

I'm struggling with dbquery syntax, please anyone tell the correct syntax.

I have configured my oracle DB with Splunk DBX, I'm able to view tables of my DB but I'm unable to query them.

Any Help is Appreciated,

Thanks.

Tags (3)
0 Karma
1 Solution

aelliott
Motivator

Syntax
dbquery

sql-database: Name of a configured database listed in the database.conf file.

dbquery-sql:
The SELECT query string to execute.
Format options:
"databaseName"
db=databaseName
database=databaseName

| dbquery "mysql" "SELECT * FROM hosts WHERE active = 1" limit=25

http://docs.splunk.com/Documentation/DBX/1.1.3/DeployDBX/Commands

View solution in original post

aelliott
Motivator

Syntax
dbquery

sql-database: Name of a configured database listed in the database.conf file.

dbquery-sql:
The SELECT query string to execute.
Format options:
"databaseName"
db=databaseName
database=databaseName

| dbquery "mysql" "SELECT * FROM hosts WHERE active = 1" limit=25

http://docs.splunk.com/Documentation/DBX/1.1.3/DeployDBX/Commands

aelliott
Motivator

they don't match what's in the database?
If so you may want to have a separate post since we got the query running 🙂

harshavrath
Contributor

but the date column is not correct.

0 Karma

harshavrath
Contributor

Thanks its working now, because of semi-colon at the end of the stmt it was giving an error.

0 Karma

harshavrath
Contributor

hey I'm leaving now will post the error message tomorrow that i'm getting.

0 Karma

aelliott
Motivator

what error is it giving you?

harshavrath
Contributor

I tried the normal select stmt
Select * from Table_Name its not working

0 Karma

aelliott
Motivator

in the db query page you just put in your query, you select a database name and write your normal query.
So just the SELECT * FROM TABLE-NAME , or select top 1000 * from TABLE-NAME

harshavrath
Contributor

what's the difference in Querying from the Search page & DB Query Page..?

0 Karma

harshavrath
Contributor

| dbquery "DB___NAME" "SELECT * FROM TABLE-NAME" LIMIT=1000
this does not work in DB Query Page but works fine in the normal Search Page.

0 Karma

aelliott
Motivator

do you have an example of something that does not work?

0 Karma

harshavrath
Contributor

This syntax works fine from the search page of DBX but it does not work in DB Query.

0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

At .conf26, Don’t Just See What’s Next. Help Shape It at Innovation Labs.

Long before a new capability reaches the keynote stage, it begins as an idea waiting to be tested. At ...

Forwarder Topology Guidance: Intermediate HF vs Intermediate UF

If you are designing a Splunk forwarding architecture, it can be tempting to place a Universal Forwarder (UF) ...

Data Management Digest – August 2026

Data Management Digest   Welcome to the August 2026 edition of Data Management Digest! August was a big month ...