Splunk Search

Can Splunk check for hosts sending data against a lookup file?

a212830
Champion

Hi,

Is it possible to have Splunk check for hosts sending data against a lookup file? I have a customer that maintains a file on a web server, which I can get via wget, and use as a lookup. I then want to validate that all of these hosts has sent data to Splunk in the last day.

Is that possible?

Tags (1)
1 Solution

MuS
Legend

Hi a212830,

sure; get this file by wget once, setup your lookup once and afterwards use a cron job or similar to do the update of the csv.

Then use something like this, to get the entries from the lookup table first, filter it based on which host you are seeing in the system logs. Let's say your lookup table is called "lookup.csv", the relevant logs have sourcetype="systemlogs" and that the field "host" exists in those log events. In that case, this search should get you going:

| inputlookup lookup.csv | search NOT [search sourcetype="systemlogs" | dedup host | fields host]

hope this helps or gets you starting to find the result you're looking for

cheers, MuS

View solution in original post

MuS
Legend

Hi a212830,

sure; get this file by wget once, setup your lookup once and afterwards use a cron job or similar to do the update of the csv.

Then use something like this, to get the entries from the lookup table first, filter it based on which host you are seeing in the system logs. Let's say your lookup table is called "lookup.csv", the relevant logs have sourcetype="systemlogs" and that the field "host" exists in those log events. In that case, this search should get you going:

| inputlookup lookup.csv | search NOT [search sourcetype="systemlogs" | dedup host | fields host]

hope this helps or gets you starting to find the result you're looking for

cheers, MuS

a212830
Champion

Thanks. I knew how to get the file into Splunk, my question was more around the search to determine which hosts hadn't reported in. This looks like what I want.

Thanks!

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

There's at least three Splunk-based ways to get this file into your instance.

First, you could define a scripted lookup that looks into the file at runtime - always giving you the most up-to-date data, but requiring a connection all the time.
Second, you could define an input using the REST Modular Input app that loads the file at a given interval into an index of your choice. Then you can use that data to do any query you like, including look for events from each host listed in the file. http://apps.splunk.com/app/1546/
Third, you could define your wget call in a small bash script that gets run by Splunk as a scripted input, similar to the modular input above.

I'm sure there are more ways, and you can of course have a cron job outside of Splunk load the file at regular intervals as well.

0 Karma

MuS
Legend

dammit, too slow again 🙂

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...

Splunk Lantern’s Guide to The Most Popular .conf25 Sessions

Splunk Lantern is a Splunk customer success center that provides advice from Splunk experts on valuable data ...

Unlock What’s Next: The Splunk Cloud Platform at .conf25

In just a few days, Boston will be buzzing as the Splunk team and thousands of community members come together ...