Splunk Search

How can I append all lookup files with uncertain names (like(name,"record*%"))?

evelenke
Contributor

Hi Splunkers,

I have lookup with WiFi authentication data (IP-Addr, mac-addr, username) . Let's say name=wifiauth_records.csv
Periodically all records are saved to a new csv file (to the same app's directory) with equal first part of name, but with different second part which is actual date ( name=wifiauth_records_20180412.csv ).
As a result for some purpose initial file always contains only records for the last 7 days.
Now I want to create search which will open and join all this files on demand to make historical search by criteria. Something like | inputlookup wifiauth_records.csv | append [|inputlookup wifiauth_records_2018*.csv]
How can I do this with SPL?

0 Karma
1 Solution

damien_chillet
Builder

You can try something like this:

| rest /services/data/lookup-table-files
| search title="wifiauth_records*"
| fields title
| map maxsearches=50 search="| inputlookup $title$"

Change maxsearches to a greater value if you have more than 50 lookups.

View solution in original post

damien_chillet
Builder

You can try something like this:

| rest /services/data/lookup-table-files
| search title="wifiauth_records*"
| fields title
| map maxsearches=50 search="| inputlookup $title$"

Change maxsearches to a greater value if you have more than 50 lookups.

evelenke
Contributor

Works, thank you!

0 Karma

evelenke
Contributor

Stuck on this:

| inputlookup [| REST /services/data/lookup-table-files  | search eai:data=*myapp* title=wifiauth_records_201803* | fields title | eval append=" | append [ | inputlookup ", close=" ] " | eval title=append+title+close | fields title | stats values(title) as t | eval t=mvjoin(t,"") | eval a=" wifiauth_records " | eval a=a+t |  fields a | return $a]

I get error Error in 'inputlookup' command: Invalid argument: '|'

Subsearch query itself returns required string that should go after | inputlookup:

wifiauth_records| append [ | inputlookup wifiauth_records_20180303.csv ] | append [ | inputlookup wifiauth_records_20180310.csv ] ....
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

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 ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...