# Receiving the report despite error 504

**URL:** <https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248>\
**Category:** Elasticsearch\
**Created:** [March 16, 2018, 9:38am UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248 "2018-03-16T09:38:04Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![emil.mirzayev](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@emil.mirzayev](https://discuss.elastic.co/u/emil.mirzayev)\
**Post date:** [March 16, 2018, 9:38am UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/1 "2018-03-16T09:38:04Z")

</div>

Hi. I scheduled a daily report to my email from my Local Kibana (localhost) instance using X-pack. When I force run this watch, I receive an 504 Error. Despite that, seconds later, I do receive the report I wanted. Report itself as PDF is around 900 Kb. It seems like it is bugged. Here I will paste both the watch config and error message I get:

```auto
PUT _xpack/watcher/watch/kpi_report
{
  "trigger" : {
    "schedule": {
      "interval": "30d"
    }
  },
  "actions" : {
    "send_email" : { 
      "email": {
        "to": "...",
        "subject": "Error Monitoring Report",
        "body": "Please, see attached daily KPIs as requested",
        "attachments" : {
          "daily_kpi.pdf" : {
            "reporting" : {
              "url": "...", 
              "retries":6, 
              "interval":"10s", 
              "auth":{ 
                "basic":{
                  "username":"elastic",
                  "password":"..."
                }
              }
            }
          }
        }
      }
    }
  }
}

```

And this will be the output of force run:

```auto
{
  "statusCode": 504,
  "error": "Gateway Time-out",
  "message": "Client request timeout"
}

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 21, 2018, 5:29pm UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/2 "2018-03-21T17:29:40Z")

</div>

where do you start this `force run`? Do you mean you start an execute watch API run?

---

<div class="post-metadata">

**Author:** ![emil.mirzayev](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@emil.mirzayev](https://discuss.elastic.co/u/emil.mirzayev)\
**Post date:** [March 21, 2018, 8:14pm UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/3 "2018-03-21T20:14:51Z")

</div>

Hi @spinscale, indeed. I do it via execute watch API

```auto
POST _xpack/watcher/kpi_report/_execute

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 21, 2018, 9:39pm UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/4 "2018-03-21T21:39:09Z")

</div>

so the timeout is coming from kibana which does not wait until the execution of the watch is finished. the execution of the watch is successfullthough

if you do

```auto
POST _xpack/watcher/kpi_report/_execute
{
  "record_execution" : true
}

```

you will get a watch history entry, that you can take a look at.

---

<div class="post-metadata">

**Author:** ![emil.mirzayev](https://avatars.discourse-cdn.com/v4/letter/e/ba9def/32.png) [@emil.mirzayev](https://discuss.elastic.co/u/emil.mirzayev)\
**Post date:** [March 22, 2018, 8:37pm UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/5 "2018-03-22T20:37:27Z")

</div>

Where do I get this history? I ran the command

```auto
POST _xpack/watcher/watch/kpi_report/_execute
{
  "record_execution": true
}

```

I get the same error

```auto
{
  "statusCode": 504,
  "error": "Gateway Time-out",
  "message": "Client request timeout"
}

```

In Elastic logs or in Kibana logs there is nothing regarding it. Elastic log:

```auto
[2018-03-22T21:19:29,024][INFO][o.e.c.r.a.DiskThresholdMonitor] [lt-mJ9i] low disk watermark [85%] exceeded on [lt-mJ9iqQ6uZrpJRqn8Mrg][lt-mJ9i][C:\Users\emirzayev\elasticsearch-6.2.2\data\nodes\0] free: 27.3gb[11.5%], replicas will not be assigned to this node
[2018-03-22T21:19:59,034][INFO][o.e.c.r.a.DiskThresholdMonitor] [lt-mJ9i] low disk watermark [85%] exceeded on [lt-mJ9iqQ6uZrpJRqn8Mrg][lt-mJ9i][C:\Users\emirzayev\elasticsearch-6.2.2\data\nodes\0] free: 27.3gb[11.5%], replicas will not be assigned to this node
[2018-03-22T21:20:29,163][INFO][o.e.c.r.a.DiskThresholdMonitor] [lt-mJ9i] low disk watermark [85%] exceeded on [lt-mJ9iqQ6uZrpJRqn8Mrg][lt-mJ9i][C:\Users\emirzayev\elasticsearch-6.2.2\data\nodes\0] free: 27.3gb[11.5%], replicas will not be assigned to this node
[2018-03-22T21:20:59,209][INFO][o.e.c.r.a.DiskThresholdMonitor] [lt-mJ9i] low disk watermark [85%] exceeded on [lt-mJ9iqQ6uZrpJRqn8Mrg][lt-mJ9i][C:\Users\emirzayev\elasticsearch-6.2.2\data\nodes\0] free: 27.3gb[11.5%], replicas will not be assigned to this node
[2018-03-22T21:21:07,006][INFO][o.e.c.m.MetaDataMappingService] [lt-mJ9i] [.watcher-history-7-2018.03.22/5TA1aMLSTn6HWcDwJCWntA] update_mapping [doc]
.........................[2018-03-22T21:20:59,209][INFO][o.e.c.r.a.DiskThresholdMonitor] [lt-mJ9i] low disk watermark [85%] exceeded on [lt-mJ9iqQ6uZrpJRqn8Mrg][lt-mJ9i][C:\Users\emirzayev\elasticsearch-6.2.2\data\nodes\0] free: 27.3gb[11.5%], replicas will not be assigned to this node

```

Kibana log:

```auto
  
  log [20:17:27.880] [info][kibana-monitoring][monitoring-ui] Stopping all Kibana monitoring collectors
  log [20:17:27.908] [info][license][xpack] Imported license information from Elasticsearch for the [monitoring] cluster: mode: trial | status: active | expiry date: 2018-04-14T17:34:37+02:00
  log [20:17:35.253] [info][kibana-monitoring][monitoring-ui] Starting all Kibana monitoring collectors
  log [20:17:35.266] [info][status][plugin:elasticsearch@6.2.2] Status changed from red to green - Ready

```

---

<div class="post-metadata">

**Author:** ![spinscale](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/spinscale/32/25011_2.png) [@spinscale](https://discuss.elastic.co/u/spinscale)\
**Post date:** [March 22, 2018, 11:38pm UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/6 "2018-03-22T23:38:42Z")

</div>

There is a time based index starting with `.watcher-history` and then containing the current date, that will hold the record execution.

You can get the latest entry via

```auto
GET .watcher-history-*/_search
{
  "size": 1,
  "query": {
    "term": {
      "watch_id": {
        "value": "YOUR_WATCH_ID_HERE"
      }
    }
  },
  "sort": [
    {
      "trigger_event.triggered_time": {
        "order": "desc"
      }
    }
  ]
}

```

---

<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:** [April 19, 2018, 11:38pm UTC](https://discuss.elastic.co/t/receiving-the-report-despite-error-504/124248/7 "2018-04-19T23:38:53Z")

</div>

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