logstash-plugins / logstash-output-http

Apache License 2.0
35 stars 82 forks source link

json format with Integer attribute convert to string value #136

Open ririkizzu opened 2 years ago

ririkizzu commented 2 years ago

Logstash information:

Please include the following information:

  1. Logstash version: logstash 7.4.1
  2. Logstash installation source: expanded from tar or zip archive
  3. How is Logstash being run: Via command line
  4. How was the Logstash Plugin installed: by default

JVM:

  1. JVM version: java version "1.8.0_251"
  2. JVM installation source: from source

OS version (uname -a if on a Unix-like system): Linux centosT-SecElk-7079 3.10.0-1160.25.1.el7.x86_64 #1 SMP Wed Apr 28 21:49:45 UTC 2021 x86_64 x86_64 x86_64 GNU/Linux

Description of the problem including expected versus actual behavior:

Steps to reproduce:

I use http output plugin to send request to server, request body contains attributes and it's type is Integer. When request to server, it seems Integer value is convert to string.

  1. http output config info like below

    http {
    url => "http://10.2.13.36:8080/post"
    http_method => "post"
    headers => {
    "token" => "token"
    }
    format => "json"
    mapping => {
    "alert_source_id" => '%{[@metadata][alert_source_id]}'
    "title" => "%{[@metadata][title]}"
    "num" => 1
    "array" => [1, 2]
    }
    }
  2. server response

    {"alert_source_id":"37","title":"HFish Threat Alert","num":"1","array":["1","2"]}