Deployment Architecture

Splunk DB connect Host Field Value from DB

pembleton
Path Finder

hi

I lately started to use Splunk db connect, and need to create an input that contains entries from different hosts.
is there any way that the host field value will be a column in the result of the SQL query, and not a constant value?

I tried to just name one of the columns 'host', but it didn't work.

1 Solution

aelliott
Motivator

Look at
Dynamically set the default host value
http://docs.splunk.com/Documentation/Splunk/6.0.1/Data/setadefaulthostforaninput
If you export your hostname as another name and use this method, you should be able to set the host based on a field returned.

View solution in original post

aelliott
Motivator

Look at
Dynamically set the default host value
http://docs.splunk.com/Documentation/Splunk/6.0.1/Data/setadefaulthostforaninput
If you export your hostname as another name and use this method, you should be able to set the host based on a field returned.

lukejadamec
Super Champion

A host by any other name is still a host.

Why not name the field/column dbhost?
That way you will know which 'host' it came from, and also be able to identify the 'host' from within the source.

0 Karma

HiroshiSatoh
Champion

Specific information a little more is required for me to answer.

↓Is not it's not the kind of thing?
SELECT *,"HOSTNAME_XXX" as host FROM TableName

0 Karma

aelliott
Motivator

You could name it DBHost and use that in searches etc..

0 Karma

d1rtym0nk3y
Explorer

no, this doesn't work for me either. the host field is ignored

0 Karma

pembleton
Path Finder

as i said above, naming one of the columns 'host' doesn't work...

0 Karma

HiroshiSatoh
Champion

Please forgive me because it is not good at English I.
Or that we also wish to retrieve the host name of the target DB on the results of SQL?

(For example, if MySQL)
select A,B,C, substring(CURRENT_USER(),locate("@",CURRENT_USER())+1) as host from TableName

0 Karma
Get Updates on the Splunk Community!

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...