Hello everyone,
I'm using the "Twitter input" and I want to put in lowercase one field, I tried some things but I didn't success ... I know that there are few changes since Logstash 5.0 (I'm using Logstash 5.1.1) with the "event API" and I don't understand how it works. This is my input data :
"entities": {
"hashtags": [
{
"indices": [
10,
16
],
"text": "data"
},...
]
},...
}
But in my ruby filter in Logstash, the "hashtags" data seem to be "hash values" :
"entities": {
"hashtags": [
{
"indices"=> [10, 16],
"text" => "DATA"
},...
]
},...
}
So, this is my ruby filter :
if ([entities][hashtags]) {
ruby {
code => '
event.get("[entities][hashtags]").each {|hash|
hash.each { |key,value|
if key == "text"
event.tag(value.downcase) # Works, create an array of lowercase values in the field "tags"
event.set("[entities][hashtags]"[hash][key], value.downcase) #Doesn't work, create an error
key= value.downcase # Doesn't work
value = value.downcase # Doesn't work
end
}
}'
}
}
I don't known what I have to do, I tried lot of things and I'm losing my mind.
Thank you in advance.