# SLOs and Maintenance Windows

**URL:** <https://discuss.elastic.co/t/slos-and-maintenance-windows/375947>\
**Category:** Kibana\
**Created:** [March 14, 2025, 4:44pm UTC](https://discuss.elastic.co/t/slos-and-maintenance-windows/375947 "2025-03-14T16:44:35Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![erikg](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@erikg](https://discuss.elastic.co/u/erikg)\
**Post date:** [March 14, 2025, 4:44pm UTC](https://discuss.elastic.co/t/slos-and-maintenance-windows/375947/1 "2025-03-14T16:44:35Z")

</div>

Hello,

I am beginning to leverage SLO's and have a basic understanding so far. I created a synthetics availability SLO for some monitors. My question lies on how SLO's consider periods of maintenance. I know Kibana's Maintenance Windows are used to help avoid triggering alerts, but would maintenance windows be considered so it doesn't affect the target for the SLO.

---

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [March 14, 2025, 7:16pm UTC](https://discuss.elastic.co/t/slos-and-maintenance-windows/375947/2 "2025-03-14T19:16:51Z")

</div>

Hi @erikg

Unfortunately the Maintenance Windows do not apply to SLOs... yeah I know a bummer. There is a design discussion on that at this time.

There is a rather low level workaround if you want roll up your sleeves. If involves some coding / work.

Here is the PR

> <https://github.com/elastic/kibana/pull/193628>
>
> resolves https://github.com/elastic/kibana/issues/191737
> 
> \## Summary
> 
> This P…R adds an optional \`pipeline\` processor to the SLO rollup pipeline. If a customer wants to override the rollup data with custom logic (for example maintenance window) they can create a pipeline names \`slo-{id}@custom\` and it will be automatically applied. Any error will be discarded.
> 
> For example create an SLO and create a custom pipeline containing a Drop processor with that condition (adjusted for the current time in UTC)
> 
> \`\`\`
> def hour = ZonedDateTime.parse(ctx\['@timestamp'\]).getHour(); 
> return hour \< 9 || hour \>= 17
> \`\`\`
> 
> ☝🏻 This will drop any document when the hour is not between 9am and 5pm

Essentially you add a custom pipeline that gets called by the SLO ingest pipeline and you drop SLOs event during the window...

Your Pipeline would look like

```auto
PUT _ingest/pipeline/slo-54f50da8-77a2-4bd3-b4e8-1daf4f45aec9@custom
{
  "pipeline": {
    "processors": [
      {
        "drop": {
          "if": "def hour = ZonedDateTime.parse(ctx['@timestamp']).getHour(); return hour < 9 || hour >= 17"
        }
      }
    ]
  }
}

```

You get the Proper UID etc from the SLO Inspect at the Bottom of Editing your Slow... Look at the Rollup Pipeline and it will show you the name of the pipeline you need to create...

 ![Screenshot 2025-03-14 at 12.09.03 PM](https://us1.discourse-cdn.com/elastic/original/3X/5/2/52086e8a49b06737c9c9294324833a7e0cf6e466.png)

Now if I was doing this...

Instead of putting the `drop` directly into that pipeline I would have THAT pipeline call my drop calendar pipeline so I could reuse in a bunch of SLOs

So mine would looke like

```auto
PUT _ingest/pipeline/slo-drop-calendar
{
    "processors": [
      {
        "drop": {
          "if": "def hour = ZonedDateTime.parse(ctx['@timestamp']).getHour(); return hour < 9 || hour >= 17"
        }
      }
    ]
  }

PUT _ingest/pipeline/slo-54f50da8-77a2-4bd3-b4e8-1daf4f45aec9@custom
{
  "processors": [
    {
      "pipeline": {
        "ignore_missing_pipeline": true,
        "ignore_failure": true,
        "name": "slo-drop-calendar"
      }
    }
  ]
}

```

EDIT: Fixed Code Above

Probably way more than you wanted... but there you go

---

<div class="post-metadata">

**Author:** ![erikg](https://avatars.discourse-cdn.com/v4/letter/e/91b2a8/32.png) [@erikg](https://discuss.elastic.co/u/erikg)\
**Post date:** [March 14, 2025, 8:04pm UTC](https://discuss.elastic.co/t/slos-and-maintenance-windows/375947/3 "2025-03-14T20:04:47Z")

</div>

> [@stephenb](#):
>
> Unfortunately the Maintenance Windows do not apply to SLOs... yeah I know a bummer.

woah thanks @stephenb !
