All Apps and Add-ons

My lookup isn't retrieving the data properly. Did I miss something?

yoshilog
Explorer

I have data that used to be in an if condition, the nameFromChannel is taken from slack, and they use the names as a sort of mechanism to filter the members that are allowed to be a part of the channel. 

The group credentials are then taken from all the members usernames and are assessed individually whether they're allowed to be a member of the group. 

It goes something like this.

 

 

| eval clientName=if(like(nameFromChannel,"%B%"),groupCredentials+ " " +"BASSI",groupCredentials)
| eval clientName=if(like(nameFromChannel,"%W%"),groupCredentials+ " " +"HI WALDORFI",groupCredentials)
| eval clientName=if(like(nameFromChannel,"%V%"),groupCredentials+ " " +"VDWI",groupCredentials)
...

 

 

(So a channel that has xxx_BW_xxx in their name, means that employees with BASSI / HI / WALDORFI attached to their display names are allowed to be members). P.S. we cut the nameFromChannel before hand, so that the only data are the letters.
After some time, we decided that we wanted to change this to a lookup, that had a csv that looked like this :

 

 

nameFromChannel, groupCredentials
%B%, BASSI
%W%, BASSI WALDORFI
%V%, VDWI

 

 

I found a few responses in the below page.

It was a lot of help when setting up the lookup, however, I noticed that the % symbols are not being recognized even after I added the WILDCARD(nameFromChannel) in the advanced options section of my lookup definition, so I changed them to *.

 

| lookup listOfCompaniesDefinition nameFromChannel OUTPUT groupCredentials
| eval clientName=if(groupCredentials="",clientName,clientName+groupCredentials)

 

After testing above, it seems that it isn't evaluating the text properly, my result isn't being displayed the same way it used to. The channels are no longer being retrieved.

Fairly new to splunk, so I would like to hear your feedback. Thank you!

0 Karma
1 Solution

manjunathmeti
Champion

hi @yoshilog.,

Field groupCredentials can be a multivalue field. You need to combine multi values before attaching them to the clientName values.

| lookup listOfCompaniesDefinition nameFromChannel OUTPUT groupCredentials
| mvcombine groupCredentials 
| eval clientName=if(groupCredentials="", clientName, clientName + " " + groupCredentials)

  

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

manjunathmeti
Champion

hi @yoshilog.,

Field groupCredentials can be a multivalue field. You need to combine multi values before attaching them to the clientName values.

| lookup listOfCompaniesDefinition nameFromChannel OUTPUT groupCredentials
| mvcombine groupCredentials 
| eval clientName=if(groupCredentials="", clientName, clientName + " " + groupCredentials)

  

If this reply helps you, an upvote/like would be appreciated.

View solution in original post

yoshilog
Explorer

Thanks for your help. It worked!

0 Karma