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
Get Updates on the Splunk Community!

Stay Connected: Your Guide to May Tech Talks, Office Hours, and Webinars!

Take a look below to explore our upcoming Community Office Hours, Tech Talks, and Webinars this month. This ...

They're back! Join the SplunkTrust and MVP at .conf24

With our highly anticipated annual conference, .conf, comes the fez-wearers you can trust! The SplunkTrust, as ...

Enterprise Security Content Update (ESCU) | New Releases

Last month, the Splunk Threat Research Team had two releases of new security content via the Enterprise ...