I'm using logstash to parse some files into elasticsearch. I would like to call a python function passing to it some arguments from logstash and then to add the value returned by the function in a new field in elasticsearch. Is there a possibility to do that?
Otherwise I would be happy if there are any other suggestions to realize my use case which is as follows: While parsing an input file with logstash's grok filter into elasticsearch, I would like to count the number of documents of the same index in elasticsearch whose field "x" value matches that of the document being parsed (the current line in the input file), divide that by the total number of documents in that index and add the result as a field to the event I'm parsing. For me the change in the number of events is important that's why I want to that while parsing (after each event) and not in a seperate script afterwards.