Basic ruby field adding not working


attempted to add a new field with ruby and not even a simple adding is working, what could be wrong?

input {
beats {
port => 5044

filter {
ruby {
code => "event['testfield'] = 'test'"

output {
elasticsearch {
hosts => ["http://localhost:9200"]
index => "test-%{+yyyy.MM.dd}"

The error:

[2020-03-16T21:44:36,713][ERROR][logstash.filters.ruby ][main] Ruby exception occurred: undefined method `=' for #LogStash::Event:0x115fa2a0

Elastic removed the ability to refer to an event as a hash years ago. Use the event.set API call.

Thank you, that was the problem, used an outdated documentation.

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