Problem with regex scripted field kibana using painless lang!

I want to create my own regex to get substring from some logs. This is my script:

if (doc['message.keyword'].length == 0) { 
    return "unavailable";
} else {
def m = /.*?http(.*?)wsdl.*?\n/.matcher(doc['message.keyword'].value);
if ( m.matches() ) {
   return m.group(1);
} else {
   return "no match";
}
}

And my result:
match case:

callId = 12345678 RESPONSE Exception :http://10.20.100.30:8000/BOC2Services/boc2/SalePointsRouteService?wsdl detail: java.net.NoRouteToHostException: No route to host

no match:

1600657611591|sendRequest_http10.20.30.1448090BO||wsdlUrl:http://10.20.30.144:8090/BOC2Services/boc2/LocationStaffSaleHistoryService?wsdl: requestContent: <soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:ser="http://service.boc2.bccs.viettel.com/">
<soapenv:Header>      <wsse:Security soapenv:mustUnderstand="1" xmlns:wsse="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-secext-1.0.xsd" xmlns:wsu="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-wssecurity-utility-1.0.xsd">
         <wsse:UsernameToken wsu:Id="UsernameToken-32ce50e8-4a5d-4040-af71-c3428d92daa7">
            <wsse:Username>order</wsse:Username>
            <wsse:Password Type="http://docs.oasis-open.org/wss/2004/01/oasis-200401-wss-username-token-profile-1.0#PasswordText">order</wsse:Password>
         </wsse:UsernameToken>
      </wsse:Security>
   </soapenv:Header>
   <soapenv:Body><ser:insertLocationStaffSale xmlns:ns2="http://service.boc2.bccs.viettel.com/"><locationStaffSaleHistory><actionDetail></actionDetail><insertTime>2020-09-21T10:06:51.590+07:00</insertTime><source>Mbccs</source><unit>VTT</unit><userName>HANTT</userName><x>21.0164359</x><y>105.78433</y></locationStaffSaleHistory></ser:insertLocationStaffSale></soapenv:Body>
</soapenv:Envelope> output exception: java.net.ConnectException: Connection refused|1600657611594|3|1|Loi sendRequest exception 4

I used to try to use /.*?http(.*?)wsdl.*?/ instead. But it even no match in two case. I tried in notpad++ and it run well.
Can you give me some idea about that?. Thanks

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