Dashboards & Visualizations

How to Add text to value only if?

marco_massari11
Communicator

Hi,

I have a lookup containing some admin users and I need to add some text like "ADS_" before the username to distinguish them from normal users. I tried:

index=myindex tag=authentication
| lookup Ads.csv Utenza AS username OUTPUT Gruppo
| fillnull value=NULL
| eval username=if(Gruppo="NULL",username, ADS_.username)
| eval action=if(match(details_message,"opened a Web Portal"),"success",action)
| search action=success dest_host!="- -"
| stats count by username
| sort count desc

 

what I'm missing?

 

Thanks in advance!

Labels (4)
0 Karma
1 Solution

ITWhisperer
SplunkTrust
SplunkTrust
| eval username=if(Gruppo="NULL",username, "ADS_".username)

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust
| eval username=if(Gruppo="NULL",username, "ADS_".username)

gcusello
SplunkTrust
SplunkTrust

Hi @marco_massari11,

the eval statement isn't correct:

index=myindex tag=authentication
| lookup Ads.csv Utenza AS username OUTPUT Gruppo
| fillnull value=NULL
| eval username=if(Gruppo="NULL",username, "ADS_".username)
| eval action=if(match(details_message,"opened a Web Portal"),"success",action)
| search action=success dest_host!="- -"
| stats count by username
| sort count desc

Ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Index This | I am a number, but when you add ‘G’ to me, I go away. What number am I?

March 2024 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with another ...

What’s New in Splunk App for PCI Compliance 5.3.1?

The Splunk App for PCI Compliance allows customers to extend the power of their existing Splunk solution with ...

Extending Observability Content to Splunk Cloud

Register to join us !   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to ...