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!

Improve Your Security Posture

Watch NowImprove Your Security PostureCustomers are at the center of everything we do at Splunk and security ...

Maximize the Value from Microsoft Defender with Splunk

 Watch NowJoin Splunk and Sens Consulting for this Security Edition Tech TalkWho should attend:  Security ...

This Week's Community Digest - Splunk Community Happenings [6.27.22]

Get the latest news and updates from the Splunk Community here! News From Splunk Answers ✍️ Splunk Answers is ...