Logstash filter http body with boolean values error

Having issues dealing with a value that needs to be a boolean in the body.
Errors
body_format json errors
{"type":"/request/invalid","title":"Bad Request","status":400,"detail":"Format of field article is invalid"}"}
body_format text errors
{"type":"/request/invalid","title":"HTTP 415 Unsupported Media Type","status":415,"detail":"HTTP 415 Unsupported Media Type"}"}

 http {
      body_format => "text"
      follow_redirects => false
      body => '{"url": "%{[article_url]}", "article": true}'
      url => "...."
      verb => "POST"
    }

    http {
      body_format => "json"
      follow_redirects => false
      body => {
        "url" => "%{[article_url]}"
        "article" => true
      }
      url => "...."
      verb => "POST"
    }

I found a resolution.
This should really be part of your documentation.

Works but you must have the headers "Content-Type"
http {
      body_format => "text"
      follow_redirects => false
      body => '{"url": "%{[article_url]}", "article": true}'
      url => "...."
      verb => "POST"
        headers => [ 
            "Content-Type", "application/json"
        ]
    }

Does not work the issue is "article" => true that causes an error
    http {
      body_format => "json"
      follow_redirects => false
      body => {
        "url" => "%{[article_url]}"
        "article" => true
      }
      url => "...."
      verb => "POST"
    }
1 Like

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