You're trying to use count as the last array index, but it isn't. Array indices start at zero, so the last index is the array length minus one.
You can't use the field in your add_field like this. This kind of syntax to use one field as the index to select something from another in those placeholders just doesn't exist in Logstash. You can only solve that with Ruby.
The following code should give you what you want: event.set("newMessage", event.get("message")[-1])
Edit: Just two more comments: If you don't need the rest of the array, you could forego the split filter and do it all with Ruby as event.get("message").split('/')[-1]. And what purpose does that grok filter have? It seems unnecessary?
That seems to be the rest of a windows line break (CRLF: \r\n) . Your original message was split from the rest of a string at \n (Unix line break LF) and the Carriage Return \r stayed. I don't know why or where that happened. But you can probably get rid of it with mutate with the strip or gsub option.
Apache, Apache Lucene, Apache Hadoop, Hadoop, HDFS and the yellow elephant
logo are trademarks of the
Apache Software Foundation
in the United States and/or other countries.