Splunk Search

sendmail addresses

DTERM
Contributor

I have a list of email addresses I need to process. Some of the emails begin with a < and end with a >. Some do not. I need all addresses to not include these characters.

I've developed the following script which strips out these characters, but how do I tell the script to ignore addresses that don't include the < or > symbol?

index=syslog_data sendmail | top to | eval T1=split(to, "<") | eval first=mvindex(T1,1) | eval T2=split(first, ">") | eval second=mvindex(T1,2)

Thanks in advance

Tags (1)
0 Karma
1 Solution

martin_mueller
SplunkTrust
SplunkTrust

Consider this:

| gentimes start=-1 increment=5m | eval email = if((starttime % 600) = 0, "<foo@bar.com>", "bar@foo.com") | eval fixedemail = replace(email, "(^<)|(>$)", "")

View solution in original post

0 Karma

martin_mueller
SplunkTrust
SplunkTrust

Consider this:

| gentimes start=-1 increment=5m | eval email = if((starttime % 600) = 0, "<foo@bar.com>", "bar@foo.com") | eval fixedemail = replace(email, "(^<)|(>$)", "")
0 Karma
Get Updates on the Splunk Community!

Introducing Splunk Enterprise 9.2

WATCH HERE! Watch this Tech Talk to learn about the latest features and enhancements shipped in the new Splunk ...

Adoption of RUM and APM at Splunk

    Unleash the power of Splunk Observability   Watch Now In this can't miss Tech Talk! The Splunk Growth ...

Routing logs with Splunk OTel Collector for Kubernetes

The Splunk Distribution of the OpenTelemetry (OTel) Collector is a product that provides a way to ingest ...