Splunk Enterprise

Exclude Old data

Sree
Loves-to-Learn

Hi,

I'm trying to exclude events that have an old timestamp in a url which look like this - 

{"timestamp": 1626739199.964, "c-ip": "178.245.92.14", "time-to-first-byte": 0.002, "sc-status": 404, "sc-bytes": 467, "cs-method": "GET", "cs-protocol": "https", "cs-host": "xxxxxxx", "cs-uri-stem": "/out/v1/bac5ea7d5e06476598d34ba48b3f1bd1/index_8_0.m3u8?start=2021-07-16T16:40:07+00:00",

 

here timestamp and the start date are different.So is there any way to index the events have start date as current day.

Thanks in advance

Labels (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Convert the start date to epoch form then filter on it.

... | eval startDate=strptime(start,"%Y-%m-%dT%H:%M:%S%:z")
| where startDate>=relative_time(now(), "@d")
---
If this reply helps you, Karma would be appreciated.
0 Karma

Sree
Loves-to-Learn

Hi @richgalloway 

Thanks for the reply but  your answer is for the splunk events that got already indexed.

I'm trying to filter the data at the sourcetype level before it gets indexed.

Tags (1)
0 Karma

richgalloway
SplunkTrust
SplunkTrust

Sorry, misunderstood the question.  Filtering at index time requires a transform that sends data to nullQueue.  The trick (for which I don't have an answer) is writing a regex that matches the current day without having to change it every day.  I'm not sure it's possible.  Perhaps Cribl can do it.

---
If this reply helps you, Karma would be appreciated.
0 Karma
Get Updates on the Splunk Community!

Aligning Observability Costs with Business Value: Practical Strategies

 Join us for an engaging Tech Talk on Aligning Observability Costs with Business Value: Practical ...

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

Splunk Up Your Game: Why It's Time to Embrace Python 3.9+ and OpenSSL 3.0

Did you know that for Splunk Enterprise 9.4, Python 3.9 is the default interpreter? This shift is not just a ...