Getting Data In

field extraction

pavanbmishra
Path Finder

Hi All,

what should be the regex while doing event extraction for srcip

 

eventtime=1604591829395228259 appid=41 srcip=192.168.1.1 dstip=192.168.2.2 srcport=47450 dstport=443

Labels (1)
Tags (2)
0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @pavanbmishra,

you shouldn't need to extract the srcip field because Splunk automatically recognizes the pairs "field=value".

Anyway, you can extract the value of srcip using the following regex:

| rex "srcip\=(?<srcip>\d+\.\d+\.\d+\.\d+)"

that you can test at https://regex101.com/r/fJaZwd/1

Ciao.

Giuseppe

View solution in original post

gcusello
SplunkTrust
SplunkTrust

Hi @pavanbmishra,

you shouldn't need to extract the srcip field because Splunk automatically recognizes the pairs "field=value".

Anyway, you can extract the value of srcip using the following regex:

| rex "srcip\=(?<srcip>\d+\.\d+\.\d+\.\d+)"

that you can test at https://regex101.com/r/fJaZwd/1

Ciao.

Giuseppe

pavanbmishra
Path Finder

Thanks,

And what about action field here

applist="sniffer-profile" action="pass" appcat="Network.Service"

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @pavanbmishra,

sam answer: you don't need field extractions, but if you want you can use one or three  similar regexes:

one regex

| rex "applist\=\"(?<applist>[^\"]+)\"\s+action\=\"(?<action>[^\"]+)\"\s+ appcat\=\"(?<appcat>[^\"]+)\""

three regexes:

| rex "applist\=\"(?<applist>[^\"]+)\""
| rex "action\=\"(?<action>[^\"]+)\""
| rex "appcat\=\"(?<appcat>[^\"]+)\""

Ciao.

Giuseppe

 

0 Karma
Get Updates on the Splunk Community!

New Release | Splunk Cloud Platform 10.1.2507

Hello Splunk Community!We are thrilled to announce the General Availability of Splunk Cloud Platform 10.1.2507 ...

🌟 From Audit Chaos to Clarity: Welcoming Audit Trail v2

&#x1f5e3; You Spoke, We Listened  Audit Trail v2 wasn’t written in isolation—it was shaped by your voices.  In ...

Splunk New Course Releases for a Changing World

Every day, the world feels like it’s moving faster with new technological breakthroughs, AI innovation, and ...