# To mute whole streams alerts on non prod hours

**URL:** <https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624>\
**Category:** Graylog Central (peer support)\
**Created:** [November 13, 2018, 2:03pm UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624 "2018-11-13T14:03:51Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![Tafsir\_Alam](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Tafsir\_Alam](https://community.graylog.org/u/Tafsir_Alam)\
**Post date:** [November 13, 2018, 2:03pm UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/1 "2018-11-13T14:03:52Z")

</div>

Hi All,

It’s Urgent please help me in this - Is there any way to mute stream alerts on non-prod hours i.e at night time. In our environment, we are getting alerts on **Slack**

1. Is there any plugin for this?
2. Can I mute all streams alerts through web-interface? Or
3. Through API-Browser?

Graylog version - 2.4.6  
Elasticsearch Version - 5.6

Thanks all in advance.

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 14, 2018, 6:55am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/2 "2018-11-14T06:55:24Z")

</div>

it is possible with a changed message processing. Because I did not know any plugin that would allow you to disable alerts for a given time you need to add a field to the messages that can act as a trigger - if the messages comes in during office our or not.

Like seen here: [https://cdn.rawgit.com/jalogisch/OpenSourceDay2018/d3ffdebf/Presentation.html#29](https://cdn.rawgit.com/jalogisch/OpenSourceDay2018/d3ffdebf/Presentation.html#29)

But no “click and ready” solution.

---

<div class="post-metadata">

**Author:** ![Tafsir\_Alam](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Tafsir\_Alam](https://community.graylog.org/u/Tafsir_Alam)\
**Post date:** [November 14, 2018, 7:00am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/3 "2018-11-14T07:00:45Z")

</div>

@jan Thanks for the great info.

One question: We need to create Pipelining for this or its possible without pipelining ?

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 14, 2018, 7:11am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/4 "2018-11-14T07:11:56Z")

</div>

> We need to create Pipelining for this or its possible without pipelining

No without Pipelines that is not possible.

---

<div class="post-metadata">

**Author:** ![Tafsir\_Alam](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Tafsir\_Alam](https://community.graylog.org/u/Tafsir_Alam)\
**Post date:** [November 14, 2018, 7:28am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/5 "2018-11-14T07:28:48Z")

</div>

@jan It means the field **set\_field(“trigger\_alert”, true);** only active when it meets the condition i.e

rule “Between 0 and 6 o’clock”

```auto
when
  to_date($message.timestamp).hourOfDay >= 0 && 
  to_date($message.timestamp).hourOfDay <= 6

```

?

And after the we need to set alert on field “trigger\_alert” ?

---

<div class="post-metadata">

**Author:** ![jan](https://sea2.discourse-cdn.com/flex016/user_avatar/community.graylog.org/jan/32/11_2.png) [@jan](https://community.graylog.org/u/jan)\
**Post date:** [November 14, 2018, 8:21am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/6 "2018-11-14T08:21:34Z")

</div>

You create a stream for the alert condition and only route the messages into this stream if trigger\_alert is set.

---

<div class="post-metadata">

**Author:** ![Tafsir\_Alam](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Tafsir\_Alam](https://community.graylog.org/u/Tafsir_Alam)\
**Post date:** [November 14, 2018, 8:23am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/7 "2018-11-14T08:23:57Z")

</div>

Thanks @jan and I will try today.

---

<div class="post-metadata">

**Author:** ![Tafsir\_Alam](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Tafsir\_Alam](https://community.graylog.org/u/Tafsir_Alam)\
**Post date:** [November 14, 2018, 8:36am UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/8 "2018-11-14T08:36:45Z")

</div>

@jan It’s giving error

 ![30%20PM](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/b/b0a44395fda1b55684506d53fc62f4b7db887d9f.png)

What I need to change in the code if I want to apply rule from 4 AM PST to 7 PM PST

 ![01%20PM](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/e/e9cfb4728cca4d17510ac45baed86bfb08c4a810.png)

These are the fileds:

 ![08%20PM](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/2X/2/2f9131246c4ed499d616dac8a28073291dcef266.png)

---

<div class="post-metadata">

**Author:** ![Tafsir\_Alam](https://avatars.discourse-cdn.com/v4/letter/t/e9bcb4/32.png) [@Tafsir\_Alam](https://community.graylog.org/u/Tafsir_Alam)\
**Post date:** [November 15, 2018, 6:27pm UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/9 "2018-11-15T18:27:37Z")

</div>

I sorted out by using the following code

```auto
rule "Pipeline on Timing"
when
  to_long(to_date($message.timestamp).hourOfDay) >= 10 &&
  to_long(to_date($message.timestamp).hourOfDay) <= 5 

then
  set_field("Pipeline_Triggered_Condition", true);
end

```

@jan I want to schedule from 10 AM UTC to 5 AM UTC i.e for 19 hours only but above code did’t work. I think it’s checking greater than value ie if i write `to_long(to_date($message.timestamp).hourOfDay) >= 5 && to_long(to_date($message.timestamp).hourOfDay) <= 10` then this will work. What I need to change in the code to schedule time between 10 AM UTC to 5 AM UTC.

Thanks

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex016/uploads/graylog/original/3X/c/7/c7c09c6b5099570133d6502b83f50ba4430de5b6.png) [@system](https://community.graylog.org/u/system)\
**Post date:** [November 29, 2018, 6:27pm UTC](https://community.graylog.org/t/to-mute-whole-streams-alerts-on-non-prod-hours/7624/10 "2018-11-29T18:27:40Z")

</div>

Closed on November 29, 2018, 6:27pm UTC

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