Getting Data In

Can I configure Heavy Forwards to Reject *Events* older than a certain age?

briancronrath
Contributor

I should clarify I am not talking about the "ignoreOlderThan" setting which by my understanding only looks at the file date, what I'm interested in here is ignoring events themselves that are older than a certain date.  We have a lot of events come in through methods other than file ingestion, and a lot of the time we get events that are older than the configured retention age on an index, which cause early eviction of other events lumped into the bucket.  I'm looking for a way if possible, to look at events on the heavy forwarders and reject them if they are older than a certain age, ideally per index if possible as well.

Labels (2)
0 Karma
1 Solution

woodcock
Esteemed Legend

props.conf:

# For now, do it for ALL sourcetypes.
[(::)?...]
TRANSFORMS-oldevents=delete-older-than-January-1-2022

transforms.conf:

[delete-older-than-January-1-2021]
# 01 Jan 2021 01:01:01 GMT = 1609462861
INGEST_EVAL = queue=if(substr(tostring(1609462861-_time),1,1)=”-“, “indexQueue”, “nullQueue”)

[delete-older-than-January-1-2022]
# 01 Jan 2022 01:01:01 GMT = 1640998861
INGEST_EVAL = queue=if(substr(tostring(1640998861-_time),1,1)=”-“, “indexQueue”, “nullQueue”)

[delete-older-than-January-1-2023]
# 01 Jan 2023 01:01:01 GMT = 1672534861
INGEST_EVAL = queue=if(substr(tostring(1672534861-_time),1,1)=”-“, “indexQueue”, “nullQueue”)

View solution in original post

woodcock
Esteemed Legend

props.conf:

# For now, do it for ALL sourcetypes.
[(::)?...]
TRANSFORMS-oldevents=delete-older-than-January-1-2022

transforms.conf:

[delete-older-than-January-1-2021]
# 01 Jan 2021 01:01:01 GMT = 1609462861
INGEST_EVAL = queue=if(substr(tostring(1609462861-_time),1,1)=”-“, “indexQueue”, “nullQueue”)

[delete-older-than-January-1-2022]
# 01 Jan 2022 01:01:01 GMT = 1640998861
INGEST_EVAL = queue=if(substr(tostring(1640998861-_time),1,1)=”-“, “indexQueue”, “nullQueue”)

[delete-older-than-January-1-2023]
# 01 Jan 2023 01:01:01 GMT = 1672534861
INGEST_EVAL = queue=if(substr(tostring(1672534861-_time),1,1)=”-“, “indexQueue”, “nullQueue”)

briancronrath
Contributor

Awesome thank you so much!  I modified it a bit to use a relative time check:

INGEST_EVAL = queue=if(substr(tostring(relative_time(now(),"-10d")-_time),1,1)="-", "indexQueue", "nullQueue")
0 Karma
Got questions? Get answers!

Join the Splunk Community Slack to learn, troubleshoot, and make connections with fellow Splunk practitioners in real time!

Meet up IRL or virtually!

Join Splunk User Groups to connect and learn in-person by region or remotely by topic or industry.

Get Updates on the Splunk Community!

Index This | What travels the world but is also stuck in place?

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

Discover New Use Cases: Unlock Greater Value from Your Existing Splunk Data

Realizing the full potential of your Splunk investment requires more than just understanding current usage; it ...

Continue Your Journey: Join Session 2 of the Data Management and Federation Bootcamp ...

As data volumes continue to grow and environments become more distributed, managing and optimizing data ...