Painless script unable to recognize special chars in String

Hi Everyone,

PLEASE HELP!!

Kibana 5.4

My team and I are trying to do a simple task: Given a string, extract a specific part of a URL. For example if my string is "GET path="/social/holiday-gift-guide/..." we want to always extract what is right after last slash of "social" and right before the slash before "guide". The use case is that "holiday-gift-guide" is just a place holder and will NOT always be the case. i.e gift-bag, christmas-tree, etc.

The following script has no errors. The assumption is that on line 8. indexOf("/social/") has special characters that proceed it which are =" . Because of this, I am not seeing expected behavior which is to return the fields I am interested in.

Can someone please give a detailed explanation on why this is happening? Not so sure that escaping the characters are going to work in this case.

Please don't post images of text as they are hardly readable and not searchable.

Instead paste the text and format it with </> icon. Check the rendering with the preview window.

I recommend debugging your code using java, starting with a given value you expect to get from the message.keyword field, and testing the result with your code.

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