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!

Mastering Data Pipelines: Unlocking Value with Splunk

 In today's AI-driven world, organizations must balance the challenges of managing the explosion of data with ...

The Latest Cisco Integrations With Splunk Platform!

Join us for an exciting tech talk where we’ll explore the latest integrations in Cisco + Splunk! We’ve ...

AI Adoption Hub Launch | Curated Resources to Get Started with AI in Splunk

Hey Splunk Practitioners and AI Enthusiasts! It’s no secret (or surprise) that AI is at the forefront of ...