Splunk Search

i want to keep the SSED_BUS-number as it is and i want mask other number and email id

DataOrg
Builder

SSED-BUS-0123 the package is failed to accept
SSED-BUS-1466 master id 1-fjdfh23
SSED-BUS-13583 master 85793
SSED-BUS-13583 master abc@gmail.com

example

SSED-BUS-0123 the package is failed to accept
SSED-BUS-1466 master id 1-XXXXX
SSED-BUS-13583 master XXXX
SSED-983-12u85 XXXXX

0 Karma

harsmarvania57
Ultra Champion

Hi @premranjithj,

Please try below run anywhere search

| makeresults 
| eval _raw="SSED-BUS-0123 the package is failed to accept
SSED-BUS-1466 master id 1-fjdfh23
SSED-BUS-13583 master 85793
SSED-BUS-13583 master abc@gmail.com"
| rex field=_raw mode=sed "s/(?m)(master)(.+)?(\s+)(\S+)$/\1\2\3####/g"

So your query will be

<yourBasesearch> | rex field=_raw mode=sed "s/(?m)(master)(.+)?(\s+)(\S+)$/\1\2\3####/g"

If you want to mask data at indextime then please do below configuration in props.conf on Indexer/HeavyForwarder whichever comes first.

[yoursourcetype]
SEDCMD-maskall = s/(?m)(master)(.+)?(\s+)(\S+)$/\1\2\3####/g
0 Karma

mayurr98
Super Champion

Try this

To get master id 1-XXXXX

| makeresults 
| eval raw="SSED-BUS-0123 the package is failed to accept
SSED-BUS-1466 master id 1-fjdfh23
SSED-BUS-13583 master 85793
SSED-BUS-13583 master abc@gmail.com"
| rex field=raw mode=sed "s/master\sid\s1-.*/master id 1-XXXX/g"

To get master XXXX

| makeresults 
| eval raw="SSED-BUS-0123 the package is failed to accept
SSED-BUS-1466 master id 1-fjdfh23
SSED-BUS-13583 master 85793
SSED-BUS-13583 master abc@gmail.com"
| rex field=raw mode=sed "s/master\s\d+/master XXXX/g"

to mask abc@gmail.com

| makeresults 
| eval raw="SSED-BUS-0123 the package is failed to accept
SSED-BUS-1466 master id 1-fjdfh23
SSED-BUS-13583 master 85793
SSED-BUS-13583 master abc@gmail.com"
| rex field=raw mode=sed "s/((\w[\w\-\.]+@\w+.com))(.*)/XXXX/g"

let me know if this helps you!

0 Karma
Career Survey
First 500 qualified respondents will receive a $20 gift card! Tell us about your professional Splunk journey.

Can’t make it to .conf25? Join us online!

Get Updates on the Splunk Community!

Splunkbase Unveils New App Listing Management Public Preview

Splunkbase Unveils New App Listing Management Public PreviewWe're thrilled to announce the public preview of ...

Leveraging Automated Threat Analysis Across the Splunk Ecosystem

Are you leveraging automation to its fullest potential in your threat detection strategy?Our upcoming Security ...

Can’t Make It to Boston? Stream .conf25 and Learn with Haya Husain

Boston may be buzzing this September with Splunk University and .conf25, but you don’t have to pack a bag to ...