Hi all,
I want to collect only certain tags from my xml file (data with Parameter tag). Here is the example of xml file I want to parse:
//     <Instrument Name="GLPO" DisplayName="AAAA" HeartBeat="BBBB">
//      <Component Name="AutoCtf" DisplayName="AutoCtf" ServiceCategory="None">
//        <Parameter ID="495" EventID="497" Name="Defocus" />
 //       <Parameter ID="496" EventID="497" Name="Astigmatism" />
//        <Parameter ID="497" EventID="497" Name="AstigmatismOrientation" />
 //     </Component>
 //   </Instrument>
    The problem is, beside right data, logstash index tags which does not have right strings. Here is what I get when run logstash:
//{
//      "@version" => "1",
//      "event_id" => [
//        [0] "498"
//    ],
//          "host" => "NLEIN-GZCVWZ1",
//          "type" => "healthmonitoring",
//     "health_id" => [
//        [0] "512"
//    ],
//    "@timestamp" => 2021-02-18T09:04:20.528Z,
//          "path" => //"C:/Users/aleksei.poliakov/Desktop/Internship/Logs/HealthMonitorCmd_20200817_153946.xml",
//       "message" => "        <Parameter ID=\"512\" EventID=\"498\" Name=\"Iteration\" //DisplayName=\"Iteration\" Type=\"Int\" StorageUnit=\"\" DisplayUnit=\"\" DisplayScale=\"\" //FormatString=\"\" ServiceCategory=\"None\" MaxLogInterval=\"00:00:00\" //AbsoluteMinimum=\"-1.7976931348623157E+308\" //AbsoluteMaximum=\"1.7976931348623157E+308\" />\r"
//}
//{
//          "@version" => "1",
//              "host" => "NLEIN-GZCVWZ1",
//              "type" => "healthmonitoring",
//        "@timestamp" => 2021-02-18T09:04:20.528Z,
//              "path" => //"C:/Users/aleksei.poliakov/Desktop/Internship/Logs/HealthMonitorCmd_20200817_153946.xml",
//           "message" => "      </Component>\r"
//}
    My config file:
// input {
//    file {
//        path => ["C:/Users/aleksei.poliakov/Desktop/Internship/Logs/HealthMonitorCmd_20200817//_153946.xml"]
//        start_position => "beginning"
//        sincedb_path => "NUL"
//        type => "healthmonitoring"
//        exclude => "*.gz"
//    }
//}
// filter {
//    xml {
//        store_xml => false
//        source => "message"
//        target => "Parameter"
//        xpath => 
//        [
//            "//Parameter/@ID", "health_id",
//            "//Parameter/@EventID", "event_id"
//        ]
//    }
//}
// output {
//    if [type] == "healthmonitoring" {
//        elasticsearch {
//            hosts => ["localhost:9200"]
//            index => "health-monitoring-%{+DDMMYYYY}"
//        }
//    }
//    stdout { }
//}
Thank you in advance!