Templated Dashboards (.json)edit

.json files are templated dashboards. An example of templating can be found on the query and filter objects of the logstash.json dashboard. Templates use handlebar syntax that allow you insert javascript clauses into your json. URL parameters are available on the ARGS object. For example, a snippet from logstash.json's (on github) query and filter services:

  "0": {
    "query": "{{ARGS.query || '*'}}",
    "alias": "",
    "color": "#7EB26D",
    "id": 0,
    "pin": false
  }

  [...]

  "0": {
    "type": "time",
    "field": "@timestamp",
    "from": "now-{{ARGS.from || '24h'}}",
    "to": "now",
    "mandate": "must",
    "active": true,
    "alias": "",
    "id": 0
  }

This allows us to set 2 parameters, query and from in the url. If they are not set, they will default to the value after the ||. For example, this would search for status:200 in the last 7 days:

Note: Take careful note of the file part of #/dashboard/file/logstash.json

http://yourserver/index.html#/dashboard/file/logstash.json?query=status:200&from=7d