Dashboards & Visualizations

regex

SN1
Path Finder

 hi , I want to extract from  this date

12/11/2024

result should be 12/2024

0 Karma
1 Solution

gcusello
SplunkTrust
SplunkTrust

Hi @SN1 ,

if this is a field (your_field), the easiest way it to use the eval functions, not a regex:

| eval date=strftime(strptime(your_field,"%m/%d/%Y"),"%m/%Y")

Ciao.

Giuseppe

View solution in original post

ITWhisperer
SplunkTrust
SplunkTrust

Apart from what @gcusello says, rex will only extract contiguous characters into a field, so what you are asking for is not possible in a single rex command.

gcusello
SplunkTrust
SplunkTrust

Hi @SN1 ,

if this is a field (your_field), the easiest way it to use the eval functions, not a regex:

| eval date=strftime(strptime(your_field,"%m/%d/%Y"),"%m/%Y")

Ciao.

Giuseppe

Get Updates on the Splunk Community!

Index This | How many sides does a circle have?

  March 2025 Edition Hayyy Splunk Education Enthusiasts and the Eternally Curious!  We’re back with this ...

New This Month - Splunk Observability updates and improvements for faster ...

What’s New? This month, we’re delivering several enhancements across Splunk Observability Cloud for faster and ...

What's New in Splunk Cloud Platform 9.3.2411?

Hey Splunky People! We are excited to share the latest updates in Splunk Cloud Platform 9.3.2411. This release ...