The following is my data in es, the right is the message that I use journalbeat to import and i want to be processed, the left is the result processed by painless
The following is the painless i wrote
if(doc['message.keyword'].size() > 0 ){
def processMsg = doc['message.keyword'].value;
if (processMsg != null && processMsg.contains("finished upload/dip job of unit")){
return processMsg
}
// String splitter = " ";
// ArrayList array=new ArrayList();
// StringTokenizer tokenValue = new StringTokenizer(processMsg, splitter);
// while (tokenValue.hasMoreTokens()) { array.add(tokenValue.nextToken()); }
// return Integer.parseInt(array[array.length()-2])
}
return 0
Actually, i want to get the data from message between the word "in" and the word "seconds", but when i use 'contains' filter the message, It doesn't always work.
I don't know how to write, please help me.