Deployment Architecture

Splunk DB Connect 1: Why dbquery "select original_column_name AS new_column_name" is not working?

hartfoml
Motivator

I am using dbquery to join two tables and display the results. Unfortunately, both tables use the column "NAME"

I want to use the AS function in SQL to rename the column from one DB so that it shows correctly in splunk like this

| dbquery "MAIN" "SELECT  m.NAME AS HOST_NAME, s.ID AS GROUP_ID, s.NAME AS GROUP_NAME FROM MAIN.MACHINE m JOIN SYS.MUID s  on m.uid=s.uid"

the "AS" clause in the SQL is not renaming the field, so splunk picks the first NAME field it sees and does not show the other NAME field in the row.

This should be a simple SQL command, but it doesn't seem to be working with Splunk DB Connect?

0 Karma

jcoates_splunk
Splunk Employee
Splunk Employee

no idea. Well, three ideas:

  • drop the SQL AS and use SPL to eval the name into something you'd rather see
  • use another JDBC tool to verify that your database isn't doing this... maybe a different driver would help?
  • File a support ticket for deeper troubleshooting
0 Karma
Get Updates on the Splunk Community!

Index This | What is broken 80% of the time by February?

December 2025 Edition   Hayyy Splunk Education Enthusiasts and the Eternally Curious!    We’re back with this ...

Unlock Faster Time-to-Value on Edge and Ingest Processor with New SPL2 Pipeline ...

Hello Splunk Community,   We're thrilled to share an exciting update that will help you manage your data more ...

Splunk MCP & Agentic AI: Machine Data Without Limits

Discover how the Splunk Model Context Protocol (MCP) Server can revolutionize the way your organization uses ...