# Usage of Logstash - Nullifying the logs when not required to be published

**URL:** <https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027>\
**Category:** Logstash\
**Tags:** docker\
**Created:** [May 22, 2023, 2:08pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027 "2023-05-22T14:08:56Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![pavan\_tiriveedhi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavan_tiriveedhi/32/121283_2.png) [@pavan\_tiriveedhi](https://discuss.elastic.co/u/pavan_tiriveedhi)\
**Post date:** [May 22, 2023, 2:08pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/1 "2023-05-22T14:08:56Z")

</div>

Hi, We are using Logstash to push logs from our kubernetes environments to Azure for storing and computing, we have installed the services via help chart - [helm-charts/logstash at main · elastic/helm-charts · GitHub](https://github.com/elastic/helm-charts/tree/main/logstash).

Most of the times we are ending in pushing logs to azure even not required, since our stack comprises large number of microservices its hard for us to stop/resume sending logs into logstash. so we would like to know if there is any possibility to enable/ disable output fields in a way it would send logs only when enabled, else logs get nullified inside pipeline/ storage itself. ?

Can explain / share some more detail information if required.

Thanks

---

<div class="post-metadata">

**Author:** ![Priscilla\_Parodi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/priscilla_parodi/32/43047_2.png) [@Priscilla\_Parodi](https://discuss.elastic.co/u/Priscilla_Parodi)\
**Post date:** [June 7, 2023, 8:08pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/2 "2023-06-07T20:08:52Z")

</div>

Hello @pavan_tiriveedhi, welcome to the community!

To achieve your goal, you can use [conditionals](https://www.elastic.co/guide/en/logstash/current/event-dependent-configuration.html#conditionals) in the Logstash pipeline to selectively include or exclude certain logs based on specific conditions.

```auto
if EXPRESSION {
  ...
} else if EXPRESSION {
  ...
} else {
  ...
}

```

Hope it helps!

---

<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:** [June 7, 2023, 9:46pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/3 "2023-06-07T21:46:05Z")

</div>

You can use a drop {} filter to discard events.

---

<div class="post-metadata">

**Author:** ![pavan\_tiriveedhi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavan_tiriveedhi/32/121283_2.png) [@pavan\_tiriveedhi](https://discuss.elastic.co/u/pavan_tiriveedhi)\
**Post date:** [June 22, 2023, 3:33pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/4 "2023-06-22T15:33:50Z")

</div>

Hi @Badger Thanks for responding back, while using the drop {} am getting below error. IT states the drop plugin is not recongized by logstash helm chart i am using.

```auto
ERROR logstash.plugins.registry - Unable to load plugin. {:type=>"output", :name=>"drop"}

ERROR logstash.agent - Failed to execute action {:action=>LogStash::PipelineAction::Create/pipeline_id:main2, :exception=>"Java::JavaLang::IllegalStateException", :message=>"Unable to configure plugins: (PluginLoadingError) Couldn't find any output plugin named 'drop'. Are you sure this is correct? Trying to load the drop output plugin resulted in this error: Unable to load the requested plugin named drop of type output. The plugin is not installed."

```

I am using the logstash helm chart - 7.17.3

---

<div class="post-metadata">

**Author:** ![pavan\_tiriveedhi](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pavan_tiriveedhi/32/121283_2.png) [@pavan\_tiriveedhi](https://discuss.elastic.co/u/pavan_tiriveedhi)\
**Post date:** [June 22, 2023, 3:34pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/5 "2023-06-22T15:34:56Z")

</div>

Yes tried using the expressions but am not sure where to point inside the expression to drop/ delete / eliminate the logs. can you please advise if there is a plugin/ command/ config can be used for discarding the logs

---

<div class="post-metadata">

**Author:** ![leandrojmp](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/leandrojmp/32/107231_2.png) [@leandrojmp](https://discuss.elastic.co/u/leandrojmp)\
**Post date:** [June 22, 2023, 3:40pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/6 "2023-06-22T15:40:14Z")

</div>

> [@pavan\_tiriveedhi](#):
>
> Thanks for responding back, while using the drop {} am getting below error. IT states the drop plugin is not recongized by logstash helm chart i am using.

You need to drop the document inside the filter block, not in the output block.

So you need to define the conditionals to drop a document inside the filter block.

---

<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:** [July 20, 2023, 3:40pm UTC](https://discuss.elastic.co/t/usage-of-logstash-nullifying-the-logs-when-not-required-to-be-published/334027/7 "2023-07-20T15:40:29Z")

</div>

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