How to add ignore node attribute when using xml filter plugin to translate xml to json?

I use http input plugin to listen on port 8080, then I passing in POST http request with XML body. Then I use xml plugin to translate it into json. But for some nodes of the XML, they have attributes with namespace information, how could I ignore them when transforming?

Here is the XML body:

<SAM_BASE xmlns="XXX Sex - Free Porn Videos at XXX.com" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<BASE_IMAGE_ID>46</BASE_IMAGE_ID>
<SAM_IMAGE_ID>7339690</SAM_IMAGE_ID>
<SAM_IMAGE_NAME>redhat7.1</SAM_IMAGE_NAME>
<SAM_POOL_ID>9</SAM_POOL_ID>
<SAM_BASEID>48</SAM_BASEID>
</SAM_BASE>
</SAM_BASEMboSet>

My config file:

input {
http{
host => "0.0.0.0"
port => "8080"
}
}

filter {
xml {
source => "message"
remove_namespaces => true
suppress_empty => true
target => "message"
}
}

output {
stdout{codec => rubydebug}
}

std output expected:

{
"@version" => "1",
"host" => "x.xxx.xx.xxx",
"headers" => {
"http_version" => "HTTP/1.1",
"http_connection" => "keep-alive",
"request_method" => "POST",
"http_host" => "x.xx.xx.xx:8080",
"request_uri" => "/",
"http_user_agent" => "xxxxxxxxxxxxx",
"http_accept_language" => "null",
"http_accept" => "/",
"content_type" => "application/xml",
"http_x_rbt_optimized_by" => "e8i-wx-sh4 (RiOS 9.1.3) SC",
"request_path" => "/",
"content_length" => "xxx"
},
"@timestamp" => 2017-11-16T10:10:49.682Z,
"message" => {
"SAM_BASE" => [
[0] {
"SAM_POOL_ID" => [
[0] "9"
],
"SAM_IMAGE_NAME" => [
[0] "redhat7.1"
],
"SAM_BASEID" => [
[0] "48"
],
"BASE_IMAGE_ID" => [
[0] "46"
],
"SAM_IMAGE_ID" => [
[0] "7339690"
]
}
],
}
}

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