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
Motivator

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
Motivator

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!

CX Day is Coming!

Customer Experience (CX) Day is on October 7th!! We're so excited to bring back another day full of wonderful ...

Strengthen Your Future: A Look Back at Splunk 10 Innovations and .conf25 Highlights!

The Big One: Splunk 10 is Here!  The moment many of you have been waiting for has arrived! We are thrilled to ...

Now Offering the AI Assistant Usage Dashboard in Cloud Monitoring Console

Today, we’re excited to announce the release of a brand new AI assistant usage dashboard in Cloud Monitoring ...