# How to filter uwsgi logs on the basis of date specified inside logs

**URL:** https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308
**Category:** Logstash
**Created:** [November 8, 2016, 6:57am UTC](https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308 "2016-11-08T06:57:51Z")
**Posts on this page:** 5
**Page:** 1

<div class="post-metadata">

### Author: ![sumitgupta0001](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@sumitgupta0001](https://discuss.elastic.co/u/sumitgupta0001)
#### Post date: [November 8, 2016, 6:57am UTC](https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308/1 "2016-11-08T06:57:51Z")

</div>

`[pid: 5413|app: 0|req: 374528/2711349] 107.167.105.4 () {82 vars in 1747 bytes} [Tue Nov 8 11:47:28 2016] GET /api/v1/core/capturedata/?tag_id=a1aa493710fc4584aafd4c066119e6a0&cid=a762b82eba66493694058cf4602f6e5a => generated 42 bytes in 4 msecs (HTTP/1.1 200) 3 headers in 96 bytes (1 switches on core 0) [pid: 5435|app: 0|req: 374397/2711350] 192.140.221.101 () {72 vars in 1561 bytes} [Tue Nov 16 11:47:28 2016] GET /api/v1/core/capturedata/?tag_id=a1aa493710fc4584aafd4c066119e6a0&cid=a762b82eba66493694058cf4602f6e5a&temp=0.29777087707226646 => generated 42 bytes in 3 msecs (HTTP/1.1 200) 3 headers in 96 bytes (1 switches on core 0)`

**here i want only those logs to be shipped to elasticsearch that are dated above [Mon Nov 15], is there any way to configure logstash for the same, i know how it works with @timestamp , but is it possible to work around with this kind of date format?**

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 8, 2016, 7:05am UTC](https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308/2 "2016-11-08T07:05:17Z")

</div>

Assuming you're using grok to extract the timestamp to a separate field you can use a date filter to parse it. However I'm not sure if you can use a conditional on that field to accomplish what you want (not without a ruby filter anyway). I'd probably use a simple string match on the timestamp field.

```nohighlight
if [timestamp] =~ /^\w+ Nov 15 / {
  elasticsearch { ... }
}

```

---

<div class="post-metadata">

### Author: ![sumitgupta0001](https://avatars.discourse-cdn.com/v4/letter/s/9fc29f/32.png) [@sumitgupta0001](https://discuss.elastic.co/u/sumitgupta0001)
#### Post date: [November 8, 2016, 7:50am UTC](https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308/3 "2016-11-08T07:50:41Z")

</div>

thanx for the help, but i dont think i can apply range over string format date and yes i will try with ruby filter that might solve my issue.

---

<div class="post-metadata">

### Author: ![magnusbaeck](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/magnusbaeck/32/44943_2.png) [@magnusbaeck](https://discuss.elastic.co/u/magnusbaeck)
#### Post date: [November 8, 2016, 9:31am UTC](https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308/4 "2016-11-08T09:31:24Z")

</div>

Your question didn't talk about any date ranges.

---

<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: [December 6, 2016, 9:31am UTC](https://discuss.elastic.co/t/how-to-filter-uwsgi-logs-on-the-basis-of-date-specified-inside-logs/65308/5 "2016-12-06T09:31:35Z")

</div>

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