Hey there,
I have Apache logs imported in ES where the "request.keyword" field contains the path of the accessed document of a server. For example: "/category/path/to/requested/data/xml/file.xml"
I want to sort in a dashboard the category of the requested file instead of the full path to have like a pie chart for example of all the "Category 1" together instead of each individual category1/etc/file.xml.
I created the following scripted field:
def path = doc['request.keyword'].value;
if (path != null) {
int secondIndex = path.indexOf('/', path.indexOf('/') + 1);
if (secondIndex > 1) {
return path.substring(1, secondIndex);
}
}
return "";
When I go over to the discover tab, the new scripted field seems to work perfectly. (See image)
When I go over to Lens in Kibana to create a visualization of all the "categories", I get the following error:
(Alternative picture location: Imgur: The magic of the Internet)
An error occurred when loading data. [lens_merge_tables] > [esaggs] > EsError"
I don't understand why the scripted field works, but doesn't let me visualize the data extracted by it.
Any help would be appreciated, I will be glad to provide extra information!
Thanks