Splunk Search

Can you help me with the following query using the coalesce command?

pfabrizi
Path Finder

I am trying this transform. Sometime the subjectuser is set and sometimes the targetuser. All works fine, but the data coming into the subject user is a dash, and that is what user is getting set to instead of the value that is correct in target user.

Is there any way around this? So, if a subject user is less than 2 characters for example?

Thanks!

0 Karma
1 Solution

woodcock
Esteemed Legend

You can use this:

EVAL-subjectuser=if(subjectuser=="-", targetuser, subjectuser)

Or in search SPL, this:

| eval subjectuser=if(subjectuser=="-", targetuser, subjectuser)

View solution in original post

0 Karma

woodcock
Esteemed Legend

You can use this:

EVAL-subjectuser=if(subjectuser=="-", targetuser, subjectuser)

Or in search SPL, this:

| eval subjectuser=if(subjectuser=="-", targetuser, subjectuser)
0 Karma

Vijeta
Influencer

you can add | replace "-" with "" in subjectuser before coalesce

0 Karma
Get Updates on the Splunk Community!

.conf24 | Day 0

Hello Splunk Community! My name is Chris, and I'm based in Canberra, Australia's capital, and I travelled for ...

Enhance Security Visibility with Splunk Enterprise Security 7.1 through Threat ...

 (view in My Videos)Struggling with alert fatigue, lack of context, and prioritization around security ...

Troubleshooting the OpenTelemetry Collector

  In this tech talk, you’ll learn how to troubleshoot the OpenTelemetry collector - from checking the ...