Splunk Search

external lookup advise

a212830
Champion

Hi,

I want to create a lookup table that will load my /etc/hosts data, so that I can associate snmp traps with actual hostnames. From what I've read, the best way(?) to do this is to call an external script, but my concern is that this script will be firing quite often, as the feed coming into splunk is quite active. Is there an alternative way of doing this? The /etc/hosts file will update at least daily, and sometimes more, so I also need a way of updating the lookup table. The size is about 3000 rows of data.

Any advise is appreciated...

Tags (2)
0 Karma

dwaddle
SplunkTrust
SplunkTrust

If you're dealing w/ SNMP traps, then your trap receiver (snmptrapd?) should be able to write into the message of the trap the host it originated from, doing a reverse lookup either in DNS or in /etc/hosts. From there, configure Splunk to extract the host name at index time from the raw event itself. This is how things like syslog are handled straight out of the box.

Ayn
Legend

If you expect the /etc/hosts file to be updated about daily, how about having a script that takes the hosts file and converts it into a file in CSV format that's suitable to use as a static lookup? Either just run it through cron, or you could have Splunk schedule when the script is run.

Ayn
Legend

Yes, indexer. These fields are being looked up at search-time, so where they originated from doesn't matter.

0 Karma

a212830
Champion

One last question? I'm looking at the doc, but it doesn't specify if the lookup should exist on the forwarder, or the indexer - any idea? I'm assuming indexer...

0 Karma

a212830
Champion

Thanks! I appreciate it.

0 Karma

Ayn
Legend

a212830
Champion

Thanks. In theory, that would work. I guess my next question is how would I "call" that static lookup?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...