Are there any limitations to what you can do with a hash table in the ruby filter? I'm trying things that work well in regular ruby, but which cause logstash --config.test_and_exit to throw an error.
I have searched the forums, and googled in general, but couldn't find anything pointing me in the right direction.
At the start of the code block I try to initialize a hash table (shortened, actually has 60+ elements):
mod_hsh = {
:A => { :aa => "AA", :ab => "AB" },
:B => { :ba => "BA", :bb => "BB" }
}
I also tried this with a different syntax:
mod_hsh = {}
mod_hsh[:A] = { :aa => "AA", :ab => "AB" }
mod_hsh[:B] = { :ba => "BA", :bb => "BB" }
and I even tried:
mod_hsh = {}
mod_hsh[:A] = [ "AA", "AB" ]
mod_hsh[:B] = [ "BA", "BB" ]
In all three cases logstash --config.test_and_exit gives a message like this:
The given configuration is invalid. Reason: Expected one of #, {, } at line 43, column 21 (byte 1037) after filter {
...(lines skipped)
ruby {
code => "
mod_hsh = {}
mod_hsh[:B] = [ "
Are there limitations to ruby inside the ruby filter code block such as the ruby version, the size or number of elements that are allowed, or that hash elements cannot be arrays or hashes themselves?
As said, the code works fine in a regular ruby environment, so what's wrong with my code?