Splunk Search

help to make regex

ckals46
New Member

hello all!

I have a sentense of raw data so I want to extract only one field.

raw data's example :

A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N

after example :

A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N
A,B,C,D,E,F,1234567891011,G,H,I,J,*,K,L,M,N

I want to change 12th field into a '*'

Please help me. Give me make it 😐

0 Karma

somesoni2
Revered Legend

You can try like this

| gentimes start=-1 | eval temp="A,B,C,D,E,F,1234567891011,G,H,I,J,1234567891011,K,L,M,N" | table temp | rename temp as _raw | rex mode=sed "s/^(([^,]*,){11})([^,]*)/\1*/"
0 Karma
Get Updates on the Splunk Community!

Announcing Scheduled Export GA for Dashboard Studio

We're excited to announce the general availability of Scheduled Export for Dashboard Studio. Starting in ...

Extending Observability Content to Splunk Cloud

Watch Now!   In this Extending Observability Content to Splunk Cloud Tech Talk, you'll see how to leverage ...

More Control Over Your Monitoring Costs with Archived Metrics GA in US-AWS!

What if there was a way you could keep all the metrics data you need while saving on storage costs?This is now ...