Extract specific key and value in Logstash

Im using Logastash to collecting data from mysql. Json result looks :

     "_source" : {
            "username" : "room_test@localhost",
            "timestamp" : 1481785195811703,
            "peer" : "user@localhost/1596084304715518942270426",
            "bare_peer" : "user@localhost",
            "xml" : "<message to='room_test1481784717020@localhost' type='groupchat' from='user@localhost'><body>msg</body><jid>456-345</jid></message>",
            "txt" : "msg",
            "id" : 6452,
            "kind" : "groupchat",
            "nick" : "user",
            "created_at" : "2016-12-15T06:59:55.000Z",
            "@version" : "1",
            "@timestamp" : "2017-02-25T12:17:52.043Z"
          }

I need extract value from "xml" key as separate value. Like this "jid": 456-345

Thank you

What have you tried?

Use the xml filter and its xpath option to extract the value.

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