# Less than or equal not working logstash filter and crashing

**URL:** <https://discuss.elastic.co/t/less-than-or-equal-not-working-logstash-filter-and-crashing/283729>\
**Category:** Logstash\
**Created:** [September 9, 2021, 4:29am UTC](https://discuss.elastic.co/t/less-than-or-equal-not-working-logstash-filter-and-crashing/283729 "2021-09-09T04:29:37Z")\
**Posts on this page:** 3\
**Page:** 2

<div class="post-metadata">

**Author:** ![Shaiju\_Sam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaiju_sam/32/86283_2.png) [@Shaiju\_Sam](https://discuss.elastic.co/u/Shaiju_Sam)\
**Post date:** [September 16, 2021, 3:26pm UTC](https://discuss.elastic.co/t/less-than-or-equal-not-working-logstash-filter-and-crashing/283729/21 "2021-09-16T15:26:24Z")

</div>

I tried with another pattern creating a field still issue is the same

```auto
input {
  beats {
    port => 5044
  }
}
filter
{
if [fields][logtype] == "Seal_Async_Logs"
{
grok {
   match => { "message" => ".*\[TIME\] Detecting content type for file took\: %{WORD:createdetectingcontentrt}"}
}
}
if [fields][logtype] == "Seal_Async_Logs" {
mutate {
   convert => { "createdetectingcontentrt" => "integer" }
}
}
if [fields][logtype] == "Seal_Async_Logs" and [createdetectingcontentrt] < 2000 {
mutate {
    add_field => { "responsetime" => "2secs" }
}
}
}

output {
    elasticsearch {
    hosts => ["http://xx.xx.xx.xx"]
    index => "seal-test-uat-%{+YYYY.MM}"
    ilm_enabled => false
}
}

```

---

<div class="post-metadata">

**Author:** ![Shaiju\_Sam](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/shaiju_sam/32/86283_2.png) [@Shaiju\_Sam](https://discuss.elastic.co/u/Shaiju_Sam)\
**Post date:** [September 17, 2021, 10:02am UTC](https://discuss.elastic.co/t/less-than-or-equal-not-working-logstash-filter-and-crashing/283729/22 "2021-09-17T10:02:19Z")

</div>

Finally it worked after I added the field again using "and" for the same field

```auto
if [fields][logtype] == "Seal_Async_Logs" and ([createdetectingcontentrt] < 2000 and [createdetectingcontentrt] < 2000) {
mutate {
    add_field => { "responsetime" => "2secs" }
}
}

```

---

<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:** [October 15, 2021, 10:02am UTC](https://discuss.elastic.co/t/less-than-or-equal-not-working-logstash-filter-and-crashing/283729/23 "2021-10-15T10:02:46Z")

</div>

Closed on October 15, 2021, 10:02am UTC

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

[Previous page](https://discuss.elastic.co/t/less-than-or-equal-not-working-logstash-filter-and-crashing/283729.md?page=1)
