# Blocking logs with certain conditions

**URL:** <https://discuss.elastic.co/t/blocking-logs-with-certain-conditions/305369>\
**Category:** Logstash\
**Created:** [May 23, 2022, 6:18am UTC](https://discuss.elastic.co/t/blocking-logs-with-certain-conditions/305369 "2022-05-23T06:18:06Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![nyquillus](https://avatars.discourse-cdn.com/v4/letter/n/c77e96/32.png) [@nyquillus](https://discuss.elastic.co/u/nyquillus)\
**Post date:** [May 23, 2022, 6:18am UTC](https://discuss.elastic.co/t/blocking-logs-with-certain-conditions/305369/1 "2022-05-23T06:18:06Z")

</div>

Hi,

There are some clients in our cluster that are sending logs longer than 1500 characters, these logs are basically useless. I was wondering if there was a way to block these kinds of logs entirely.

Thanks in advance.

---

<div class="post-metadata">

**Author:** ![Rios](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/rios/32/95745_2.png) [@Rios](https://discuss.elastic.co/u/Rios)\
**Post date:** [May 23, 2022, 6:59am UTC](https://discuss.elastic.co/t/blocking-logs-with-certain-conditions/305369/2 "2022-05-23T06:59:27Z")

</div>

To drop a message over 1500 chars, should be something like this:

```auto
  ruby { code => "event.set('[linelength]', event.get('[request]').length)" }

  mutate { 
       convert => { "linelength" => "integer" } 
  }

  if [linelength]>1500 {
       drop { }
  }
  mutate {
       remove_field => ["linelength"]
  }

```

Other option is to keep this messages as proof of flooding/inconsistency and save in a separated index.

---

<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:** [June 20, 2022, 6:59am UTC](https://discuss.elastic.co/t/blocking-logs-with-certain-conditions/305369/3 "2022-06-20T06:59:44Z")

</div>

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