Security

search time regular expression.

jsuryaprakash
Path Finder

Hi All , below is my sample data. We are receiving data using key=value pairs like below.

time=time1 | dest_ip=abmncd.com-123.45.64.78|src_ip=nahahha.com-142.36.28.69|action=success........

I just want to extract just ip address's from dest_ip and src_ip fields at search time in props.conf . when i write rex in search its working, below is my search command which is working..

index =test | rex field=dest_ip "(?(\d{1,3}.){3}\d{1,3})" |rex field src_ip "(?(\d{1,3}.){3}\d{1,3})"

But when i create inline extract in props.conf its not working.

[sourcetype]
EXTRACT-dest_ip = dest_ip="(?(\d{1,3}.){3}\d{1,3})"
EXTRACT-src_ip = src_ip ="(?(\d{1,3}.){3}\d{1,3})"

We need to use the same field names to work with CIM datamodels. we are ok with search time extraction or index time extractions also.Please help

Thanks

Tags (1)
0 Karma

gaurav_maniar
Builder

Hi Jsuryaprakash,

Your EXTRACT stanza syntax is incorrect, change it to

EXTRACT-dest_ip = dest_ip\=[^\-]+\-(?P<dest_ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})
EXTRACT-src_ip = src_ip\=[^\-]+\-(?P<src_ip>\d{1,3}\.\d{1,3}\.\d{1,3}\.\d{1,3})

Please upvote and accept the answer if it helps.

0 Karma

jsuryaprakash
Path Finder

No, its not working. Still field are coming with dns name ip combinations.

0 Karma

gaurav_maniar
Builder

Splunk restart is restart is required if any configuration changes are done, have restarted splunk after these configuration changes?

Even after restart it doesn't work, let me know.

0 Karma
Get Updates on the Splunk Community!

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 ...

Welcome to the Splunk Community!

(view in My Videos) We're so glad you're here! The Splunk Community is place to connect, learn, give back, and ...

Tech Talk | Elevating Digital Service Excellence: The Synergy of Splunk RUM & APM

Elevating Digital Service Excellence: The Synergy of Real User Monitoring and Application Performance ...