All Apps and Add-ons

Lookup Command doesn't support * symbol

Pils
Engager

Hello,

I'm facing a problem with my lookup command.
Here is the context :

I'v 1 csv :

patterntype
*ABC*1
*DEF*2
*xxx*3

And logs with "url".
Ex : "xxxxabcxxxxx.google.com"

I need to search if, in my url field of my log, all the possibilities of my lookup are present. If yes, how much matches with this field.

My expected result is :

urltypecount(type)
xxxxabcxxxxx.google.com

1

3

2

 

How can i do ?

-"| lookup" command don't take into account the "*" symbol. Only space or comma with "WIDLCARD" config.
-"| inputlookup" command works but can't display the field "type" because it only exists in my csv. So, i can't count either.

Thank's for your answers

Labels (1)
0 Karma
1 Solution

marnall
Builder

You could make a lookup definition for that lookup, and under the Advanced options, set the pattern field as wildcard. Like this:

marnall_0-1711487546084.png

 

Match type must have "WILDCARD(pattern)"

Then you can run a lookup on this lookup definition using the url field, and return the "type" field values. Type will be a multi-value field, so you can eval mvcount on it to get the count of values.

| makeresults
| eval url = "xxxxabcxxxxx.google.com"
| lookup testcsv pattern as url output type as type
| eval count = mvcount(type)

View solution in original post

0 Karma

marnall
Builder

You could make a lookup definition for that lookup, and under the Advanced options, set the pattern field as wildcard. Like this:

marnall_0-1711487546084.png

 

Match type must have "WILDCARD(pattern)"

Then you can run a lookup on this lookup definition using the url field, and return the "type" field values. Type will be a multi-value field, so you can eval mvcount on it to get the count of values.

| makeresults
| eval url = "xxxxabcxxxxx.google.com"
| lookup testcsv pattern as url output type as type
| eval count = mvcount(type)
0 Karma

Pils
Engager

Hello marnall,

First of all, thank you for your reply.

I thought the "wildcard" option was only used for fields containing spaces or commas. And that with the symbol * it didn't work.

I'll try this quickly and report back here.

Regards

0 Karma

Pils
Engager

Hello,

Unfortunately, I've used your exact method and the result doesn't work.
I do have my line indicating my "url".
But nothing in "type" nor in its "count".

Maybe I made a mistake by indicating the wrong "destination app" when creating the "lookup definition"? What should I put?

Thanks

Regards

0 Karma

Pils
Engager

I've found the solution. The problem was mine.
If I put : "testcsv.csv" -> it doesn't work.

But if I remove the ".csv", it works perfectly...

Thanks for your reply.

0 Karma
Get Updates on the Splunk Community!

Built-in Service Level Objectives Management to Bridge the Gap Between Service & ...

Wednesday, May 29, 2024  |  11AM PST / 2PM ESTRegister now and join us to learn more about how you can ...

Get Your Exclusive Splunk Certified Cybersecurity Defense Engineer at Splunk .conf24 ...

We’re excited to announce a new Splunk certification exam being released at .conf24! If you’re headed to Vegas ...

Share Your Ideas & Meet the Lantern team at .Conf! Plus All of This Month’s New ...

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