# Adobe Acrobat Reader could not open 'dashboard.pdf'

**URL:** https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234
**Category:** Elasticsearch
**Created:** [October 25, 2017, 11:39am UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234 "2017-10-25T11:39:37Z")
**Posts on this page:** 8
**Page:** 1

<div class="post-metadata">

### Author: ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)
#### Post date: [October 25, 2017, 11:39am UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/1 "2017-10-25T11:39:38Z")

</div>

Hi All,

I created a watcher with an email action to generate a dashboard pdf and send that out to an email address. In principal this works however the pdf cannot be opened with the error:

> Adobe Acrobat Reader could not open 'dashboard.pdf' because it is either not a supported file type or because the file has been damaged (for example, it was sent as an email attachment and wasn't correctly decoded).

The watcher config I use is the following.

```
{
  "trigger": {
    "schedule": {
      "interval": "5m"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "clog-*"
        ],
        "types": [
          "logs"
        ],
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "must": [
                {
                  "query_string": {
                    "query": "program:GW AND EnvID:p-xxxxn AND action:P6_ACCEPT_DEFAULT AND _exists_:hdr_subject AND cm_score: [0 TO 90]",
                    "analyze_wildcard": true
                  }
                },
                {
                  "range": {
                    "@timestamp": {
                      "gte": "now-5m",
                      "lte": "now"
                    }
                  }
                }
              ],
              "must_not": []
            }
          },
          "aggs": {
            "subjects": {
              "terms": {
                "field": "hdr_subject.keyword",
                "min_doc_count": 10,
                "size": 5,
                "order": {
                  "_count": "desc"
                }
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "script": {
      "source": "if (ctx.payload.hits.total < 1) return false; for(int i=0; i < ctx.payload.aggregations.subjects.buckets.size(); i++) if (ctx.payload.aggregations.subjects.buckets[i].doc_count > 10) return true",
      "lang": "painless"
    }
  },
  "actions": {
    "standard_account": {
      "throttle_period_in_millis": 900000,
      "email": {
        "profile": "standard",
        "attachments": {
          "dashboard.pdf": {
            "http": {
              "request": {
                "scheme": "http",
                "host": "my.kibana.host",
                "port": 5601,
                "method": "post",
                "path": "/api/reporting/generate/dashboard/AV9R_W0QON_pt8a4d3oh&sync",
                "params": {},
                "headers": {
                  "kbn-xsrf": "reporting"
                },
                "auth": {
                  "basic": {
                    "username": "elastic"
                  }
                },
                "read_timeout_millis": 300000
              },
              "content_type": "application/pdf"
            }
          }
        },
        "priority": "high",
        "to": [
          "destination@example.com"
        ],
        "subject": "Possible spam run detected (TEST).",
        "body": {
          "text": "Possible spam run detected. Encountered {{ctx.payload.hits.total}} subjects in 5 minutes, see attached data"
        }
      }
    }
  }
}

```

If I generate the report from kibana it works fine.  
Is there something else I need to set to generate a correct pdf?

---

<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: [October 25, 2017, 12:27pm UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/2 "2017-10-25T12:27:51Z")

</div>

what is the size of the produced PDF file?

can you share the output of the watch history or the execute watch api?

---

<div class="post-metadata">

### Author: ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)
#### Post date: [October 25, 2017, 12:48pm UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/3 "2017-10-25T12:48:25Z")

</div>

The size of the pdf is 158Kb. The output of the execution is this:

```
{
  "watch_id": "esrd",
  "state": "executed",
  "status": {
    "state": {
      "active": true,
      "timestamp": "2017-10-25T11:44:33.347Z"
    },
    "last_checked": "2017-10-25T12:43:36.790Z",
    "last_met_condition": "2017-10-25T12:43:36.790Z",
    "actions": {
      "standard_account": {
        "ack": {
          "timestamp": "2017-10-25T11:48:36.958Z",
          "state": "ackable"
        },
        "last_execution": {
          "timestamp": "2017-10-25T12:43:36.790Z",
          "successful": true
        },
        "last_successful_execution": {
          "timestamp": "2017-10-25T12:43:36.790Z",
          "successful": true
        },
        "last_throttle": {
          "timestamp": "2017-10-25T12:38:36.716Z",
          "reason": "throttling interval is set to [15 minutes] but time elapsed since last execution is [14 minutes, 59 seconds and 747 milliseconds]"
        }
      }
    }
  },
  "trigger_event": {
    "type": "schedule",
    "triggered_time": "2017-10-25T12:43:36.790Z",
    "schedule": {
      "scheduled_time": "2017-10-25T12:43:36.571Z"
    }
  },
  "input": {
    "search": {
      "request": {
        "search_type": "query_then_fetch",
        "indices": [
          "clog-*"
        ],
        "types": [
          "logs"
        ],
        "body": {
          "size": 0,
          "query": {
            "bool": {
              "must": [
                {
                  "query_string": {
                    "query": "program:GW AND EnvID:p-xxxxxn AND action:P6_ACCEPT_DEFAULT AND _exists_:hdr_subject AND cm_score: [0 TO 90]",
                    "analyze_wildcard": true
                  }
                },
                {
                  "range": {
                    "@timestamp": {
                      "gte": "now-5m",
                      "lte": "now"
                    }
                  }
                }
              ],
              "must_not": []
            }
          },
          "aggs": {
            "subjects": {
              "terms": {
                "field": "hdr_subject.keyword",
                "min_doc_count": 10,
                "size": 5,
                "order": {
                  "_count": "desc"
                }
              }
            }
          }
        }
      }
    }
  },
  "condition": {
    "script": {
      "source": "if (ctx.payload.hits.total < 1) return false; for(int i=0; i < ctx.payload.aggregations.subjects.buckets.size(); i++) if (ctx.payload.aggregations.subjects.buckets[i].doc_count > 10) return true",
      "lang": "painless"
    }
  },
  "metadata": {
    "name": "eSRD"
  },
  "result": {
    "execution_time": "2017-10-25T12:43:36.790Z",
    "execution_duration": 651,
    "input": {
      "type": "search",
      "status": "success",
      "payload": {
        "_shards": {
          "total": 6,
          "failed": 0,
          "successful": 6,
          "skipped": 0
        },
        "hits": {
          "hits": [],
          "total": 818,
          "max_score": 0
        },
        "took": 12,
        "timed_out": false,
        "aggregations": {
          "subjects": {
            "doc_count_error_upper_bound": 6,
            "sum_other_doc_count": 324,
            <snip>
          }
        }
      },
      "search": {
        "request": {
          "search_type": "query_then_fetch",
          "indices": [
            "clog-*"
          ],
          "types": [
            "logs"
          ],
          "body": {
            "size": 0,
            "query": {
              "bool": {
                "must": [
                  {
                    "query_string": {
                      "query": "program:GW AND EnvID:p-xxxxn AND action:P6_ACCEPT_DEFAULT AND _exists_:hdr_subject AND cm_score: [0 TO 90]",
                      "analyze_wildcard": true
                    }
                  },
                  {
                    "range": {
                      "@timestamp": {
                        "gte": "now-5m",
                        "lte": "now"
                      }
                    }
                  }
                ],
                "must_not": []
              }
            },
            "aggs": {
              "subjects": {
                "terms": {
                  "field": "hdr_subject.keyword",
                  "min_doc_count": 10,
                  "size": 5,
                  "order": {
                    "_count": "desc"
                  }
                }
              }
            }
          }
        }
      }
    },
    "condition": {
      "type": "script",
      "status": "success",
      "met": true
    },
    "actions": [
      {
        "id": "standard_account",
        "type": "email",
        "status": "success",
        "email": {
          "account": "standard_account",
          "message": {
            "id": "esrd_9b54d4e5-80b6-4403-ab51-8004433cc13b-2017-10-25T12:43:36.790Z",
            "from": "from@example.com",
            "priority": "high",
            "sent_date": "2017-10-25T12:43:36.907Z",
            "to": [
              "ouput@example.com"
            ],
            "subject": "Possible spam run detected (TEST).",
            "body": {
              "text": "Possible spam run detected. Encountered 818 subjects in 5 minutes, see attached data"
            }
          }
        }
      }
    ]
  },
  "messages": []
}
```

---

<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: [October 25, 2017, 1:37pm UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/4 "2017-10-25T13:37:24Z")

</div>

That looks ok, would it be possible to share that PDF? If you dont want to upload it, you can also email it to me directly, $firstname.$lastname@elastic.co (note the missing m at the end of the domain 🙂

Thanks so much!

--Alex

---

<div class="post-metadata">

### Author: ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)
#### Post date: [October 25, 2017, 2:47pm UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/5 "2017-10-25T14:47:38Z")

</div>

I have send the email.

Thanks for looking.

---

<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: [October 25, 2017, 4:20pm UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/6 "2017-10-25T16:20:30Z")

</div>

What Elasticsearch version is this? I dont think you should use the HTTP input for your attachment but the dedicated [reporting](https://www.elastic.co/guide/en/x-pack/5.6/actions-email.html#configuring-email-attachments) one

If you do, you can also get rid of the `sync` parameter.

---

<div class="post-metadata">

### Author: ![pjanzen](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pjanzen/32/13756_2.png) [@pjanzen](https://discuss.elastic.co/u/pjanzen)
#### Post date: [October 26, 2017, 5:41am UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/7 "2017-10-26T05:41:29Z")

</div>

I got this fixed after reading the docs a little better and resetup the action part.

Thanks for you pointer..

---

<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: [November 23, 2017, 5:42am UTC](https://discuss.elastic.co/t/adobe-acrobat-reader-could-not-open-dashboard-pdf/105234/8 "2017-11-23T05:42:01Z")

</div>

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