logstash 日志存储错误:代理无法执行操作

uoifb46i  于 2022-12-09  发布在  Logstash
关注(0)|答案(1)|浏览(205)
    • XML范例:**
<?xml version="1.0" encoding="UTF-8"?>
<soap:Envelope xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
   <soap:Header>
      <Header xmlns="https://kjkjj.com/kkkk" xmlns:ns2="https://sih.sadad.com/common">
         <ns2:RequestID>1a7f81ac-355f-11ec-bc47-3b3678cb106a</ns2:RequestID>
      </Header>
   </soap:Header>
   <soap:Body>
      <PaymentValidationResponse xmlns="https://######.com" xmlns:ns2="https://s/###/##">
         <StatusCode>0</StatusCode>
         <StatusDescription>Success</StatusDescription>
         <PaymentValidations>
            <PaymentValidation>
               <InvoiceCode>175810975800</InvoiceCode>
               <SupplierID>649</SupplierID>
               <SupplierName>MED</SupplierName>
               <Amount>2552.23</Amount>
               <StatusCode>0</StatusCode>
            </PaymentValidation>
         </PaymentValidations>
      </PaymentValidationResponse>
   </soap:Body>
</soap:Envelope>

我想使用XPATH解析XML字段,但是我在执行这个过滤器时得到了一个错误,我还没明白是什么错误。

  • 谢谢-谢谢
lsmd5eda

lsmd5eda1#

过滤器插件配置:

filter {
     
     multiline {
         pattern =>  "<soap:Body>"
         what => "previous"
         negate => "true"
     }
     xml {
        source => "message"
        store_xml => false
        remove_namespaces => true
     
        xpath => [
            "/soap:Envelope/soap:Header/Header/RequestID/text()", "RequestID",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/StatusDescription/text()", "StatusDescription",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/PaymentValidations/PaymentValidation/InvoiceCode/text()", "InvoiceCode",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/PaymentValidations/PaymentValidation/SupplierID/text()", "SupplierID",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/PaymentValidations/PaymentValidation/SupplierName/text()", "SupplierName",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/PaymentValidations/PaymentValidation/Amount/text()", "Amount",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/PaymentValidations/PaymentValidation/StatusCode/text()", "StatusCode",
            "/soap:Envelope/soap:Body/PaymentValidationResponse/PaymentValidations/PaymentValidation/ErrorMessage/text()", "ErrorMessage"
        ]
     }
     
     mutate {
              add_field => ["StatusDescription", "%{StatusDescription}"]
              #add_field => ["NameIndexed", "%{Name}"]
            }     
}

相关问题