# Apply filters

**URL:** <https://discuss.elastic.co/t/apply-filters/329510>\
**Category:** Logstash\
**Created:** [April 6, 2023, 12:48pm UTC](https://discuss.elastic.co/t/apply-filters/329510 "2023-04-06T12:48:12Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![serjio](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@serjio](https://discuss.elastic.co/u/serjio)\
**Post date:** [April 6, 2023, 12:48pm UTC](https://discuss.elastic.co/t/apply-filters/329510/1 "2023-04-06T12:48:12Z")

</div>

good afternoon. Recently I started to get acquainted with ELK and aot what is my problem:  
I use such a filter

```auto

filter {
 if [type] == "syslog" {
    grok {
        match => { "message" => "<%{POSINT:syslog_pri}>%{SYSLOGTIMESTAMP:syslog_timestamp} %{SYSLOGHOST:syslog_hostname} %{DATA:syslog_program}(?:\[%{POSINT:syslog_pid}\])?: %{GREEDYDATA:syslog_message}" }
    }
  }
  date {
        match => ["timestamp" , "dd/MMM/YYYY:HH:mm:ss Z"]
  }
}

```

I need to filter the log not by the time it was shipped to ELK, but by the actual event of the log entry. How can I achieve this?

---

<div class="post-metadata">

**Author:** ![serjio](https://avatars.discourse-cdn.com/v4/letter/s/a87d85/32.png) [@serjio](https://discuss.elastic.co/u/serjio)\
**Post date:** [April 12, 2023, 6:32am UTC](https://discuss.elastic.co/t/apply-filters/329510/2 "2023-04-12T06:32:44Z")

</div>

does no one really know how to do this?

---

<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:** [April 12, 2023, 3:29pm UTC](https://discuss.elastic.co/t/apply-filters/329510/3 "2023-04-12T15:29:23Z")

</div>

You are extracting the timestamp from the log message into [syslog\_timestamp], but using the date filter to parse a different field. Parse the [syslog\_timestamp].

---

<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:** [May 10, 2023, 3:29pm UTC](https://discuss.elastic.co/t/apply-filters/329510/4 "2023-05-10T15:29:36Z")

</div>

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