logstash-filter-rest icon indicating copy to clipboard operation
logstash-filter-rest copied to clipboard

Documentation update : json configuration parameter

Open Heyji2 opened this issue 3 years ago • 0 comments

It is more a documentation improvement.

It was not obvious for me that the json configuration parameter is meant to specify that the response is expecte to have a json format. What else could it be, will you ask...rather than having users to deduce it, it find it easier to use when it is written.

filter {
  rest {
    request => {
      url => "http://example.com"        # string (required, with field reference: "http://example.com?id=%{id}" or params, if defined)
      method => "post"                   # string (optional, default = "get")
      headers => {                       # hash (optional)
        "key1" => "value1"
        "key2" => "value2"
      }
      auth => {
        user => "AzureDiamond"
        password => "hunter2"
      }
      params => {                        # hash (optional, available for method => "get" and "post"; if post it will be transformed into body hash and posted as json)
        "key1" => "value1"
        "key2" => "value2"
        "key3" => "%{somefield}"         # sprintf is used implicitly
      }
    }
    json => true                         # is json the format of the target ? boolean (optional, default = true)
    target => "my_key"                   # string (mandatory, no default)
    fallback => {                        # hash describing a default in case of error
      "key1" => "value1"
      "key2" => "value2"
    }
  }
}

Heyji2 avatar Sep 24 '21 13:09 Heyji2