# Filter data based on dates and days

**URL:** <https://discuss.elastic.co/t/filter-data-based-on-dates-and-days/323681>\
**Category:** Logstash\
**Created:** [January 22, 2023, 3:57pm UTC](https://discuss.elastic.co/t/filter-data-based-on-dates-and-days/323681 "2023-01-22T15:57:33Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![stella\_raj](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stella_raj/32/116257_2.png) [@stella\_raj](https://discuss.elastic.co/u/stella_raj)\
**Post date:** [January 22, 2023, 3:57pm UTC](https://discuss.elastic.co/t/filter-data-based-on-dates-and-days/323681/1 "2023-01-22T15:57:33Z")

</div>

Hi,

Need to filter data based on specific dates and days.  
Suggest any filter plugin that will fulfil my requirement.

Thanks

---

<div class="post-metadata">

**Author:** ![sai\_saran1](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/sai_saran1/32/116661_2.png) [@sai\_saran1](https://discuss.elastic.co/u/sai_saran1)\
**Post date:** [January 22, 2023, 4:27pm UTC](https://discuss.elastic.co/t/filter-data-based-on-dates-and-days/323681/2 "2023-01-22T16:27:32Z")

</div>

You can use ruby filter with the specific condition something like the below if you are getting the day in the logline

```auto
ruby {
code => "event.cancel if "Day" = "Sunday""
}

```

---

<div class="post-metadata">

**Author:** ![Badger](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/badger/32/25190_2.png) [@Badger](https://discuss.elastic.co/u/Badger)\
**Post date:** [January 23, 2023, 3:50am UTC](https://discuss.elastic.co/t/filter-data-based-on-dates-and-days/323681/3 "2023-01-23T03:50:31Z")

</div>

If you want to drop events then you can either use a `drop {}` filter (if you can identify the events using a logstash conditional) or use event.cancel within a ruby filter to implement much more complicated filtering of events.

How to choose between them will require a more detailed problem specification. For example, do you want to drop everything from a certain list of dates, or everything on a Saturday? Is this based on [@timestamp] or some other field?

Please show a field you want to filter on, either from the output of `output { stdout { codec => rubydebug } }`, or else JSON from Kibana, as well a specific example of filtering that you want to implement.

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 20, 2023, 3:51am UTC](https://discuss.elastic.co/t/filter-data-based-on-dates-and-days/323681/4 "2023-02-20T03:51:06Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
