Splunk Search

Rex not working for special characters

jravida
Communicator

Hi Folks,

I've worked out a regex to pull out group names from audit logs. It works for one field with no special characters, but in another, more elaborated field, my rex becomes confused.
Example

|rex "\w+ added to (?"EXTRACTION SHOULD BE HERE BUT SPLUNK.com FILTERS THE TAGS"\w+) in the \w+"

"Member Bill added to Mail Admin in the Restricted Groups Policy PostOffice"

works fine, but when it becomes more complex I am not sure how to have the rex query ignore all the special characters that may show up

"Member Bill added to Mail Admin in the Restricted Groups Policy (SLASHES)K12\\DC5000Dallas [WEDT] Mail Admin"

This turns up nothing. So basically I want to eliminate the slashes (that don't show up here oddly) and [] that get mixed in, just ignore after the group name extraction. Thanks in advance!

Edit, splunk filters out the tags so the rex looks weird but I'm using the correct named extration

Tags (2)
1 Solution

somesoni2
Revered Legend

Try this

|rex "(\w+\s)+added to (?<myField>.*) in the"

View solution in original post

somesoni2
Revered Legend

Try this

|rex "(\w+\s)+added to (?<myField>.*) in the"

ppablo
Retired

There's a reason @somesoni2 is always the #1 or #2 ranked user on Answers 😜

0 Karma

sk314
Builder

that was fast! didn't see it before I posted a somewhat similar regex!!

0 Karma

jravida
Communicator

Thanks for the fast response! I was a bit more off than I though!

0 Karma

jravida
Communicator

I just want to pull out "Mail Admin" and discard the rest

0 Karma

sk314
Builder

could you specify what would be the correct extraction in the last example (the one with [WEDT])?

0 Karma
Get Updates on the Splunk Community!

Introducing the 2024 SplunkTrust!

Hello, Splunk Community! We are beyond thrilled to announce our newest group of SplunkTrust members!  The ...

Introducing the 2024 Splunk MVPs!

We are excited to announce the 2024 cohort of the Splunk MVP program. Splunk MVPs are passionate members of ...

Splunk Custom Visualizations App End of Life

The Splunk Custom Visualizations apps End of Life for SimpleXML will reach end of support on Dec 21, 2024, ...