elastic / kibana

Your window into the Elastic Stack
https://www.elastic.co/products/kibana
Other
19.77k stars 8.17k forks source link

Support YAML in Logstash Configuration Management API #29655

Open JohnLyman opened 5 years ago

JohnLyman commented 5 years ago

Describe the feature:

From #28754:

Most APIs of Elasticsearch support YAML requests and ES can send responses also in YAML. Please consider supporting it also in Dev Tools -> Console.

Building on that request, I would also like the ability to GET/PUT with YAML while using the Logstash Configuration Management API. As mentioned above, most Elasticsearch APIs already support YAML. The referenced issue also lists many reasons YAML might be preferable over JSON, which are also relevant here.

Describe a specific use case for the feature:

Specifically, this would be nice for configuring Logstash pipelines via the API. Many of my pipeline definitions are over 50 lines. It is difficult to view/edit them when they are collapsed down into a single string with encoded new lines (\n) and escaped quotation marks, etc. With YAML, I could use a block scalar and have the pipeline look exactly like it does in the web UI.

Example:

(Showing just the pipeline key for brevity)

JSON:

"pipeline":"input {\n    beats {\n        port => \"5044\"\n    }\n}\n filter {\n    grok {\n        match => { \"message\" => \"%{COMBINEDAPACHELOG}\"}\n    }\n    geoip {\n        source => \"clientip\"\n    }\n}\noutput {\n    elasticsearch {\n        hosts => [ \"localhost:9200\" ]\n    }\n}"

YAML:

pipeline: |-
  input {
      beats {
          port => "5044"
      }
  }
  filter {
      grok {
          match => { "message" => "%{COMBINEDAPACHELOG}"}
      }
      geoip {
          source => "clientip"
      }
  }
  output {
      elasticsearch {
          hosts => [ "localhost:9200" ]
      }
  }
elasticmachine commented 5 years ago

Pinging @elastic/kibana-platform