Getting Data In

regex

pavanbmishra
Path Finder

what should the best regex to catch it up these 3 diff fields 

 

-ec-1
-ec-01
-ec01

Labels (1)
Tags (1)
0 Karma

pavanbmishra
Path Finder

We have host field ending with these strings ( -ec-1/-ec-01/-ec01)have to be captured through regex.

abc-ec-1
xyz-ec-01
pqr-ec01

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @pavanbmishra,

please try this

\w+-(?<your_field>.*)

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

Ciao.

Giuseppe

0 Karma

gcusello
SplunkTrust
SplunkTrust

Hi @pavanbmishra,

could you share a sample of your logs to be more sure?

Anyway, if these are the strings to extract as field, you could use:

| rex "(?<your-field>ex[^ ]+)"

But, please share your logs.

ciao.

Giuseppe

0 Karma
Get Updates on the Splunk Community!

Splunk Platform | Upgrading your Splunk Deployment to Python 3.9

Splunk initially announced the removal of Python 2 during the release of Splunk Enterprise 8.0.0, aiming to ...

From Product Design to User Insights: Boosting App Developer Identity on Splunkbase

co-authored by Yiyun Zhu & Dan Hosaka Engaging with the Community at .conf24 At .conf24, we revitalized the ...

Detect and Resolve Issues in a Kubernetes Environment

We’ve gone through common problems one can encounter in a Kubernetes environment, their impacts, and the ...