There no indication in the doc that rename{}
takes a regexp.
I've seen this done with a ruby{}
filter.
As requested, here's some untested Ruby:
begin
keys = event.to_hash.keys
keys.each{|key|
if ( key =~ /_/ )
newkey = key.gsub(/_/, '')
event[newkey] = event.remove(key)
end
}
rescue Exception => e
event['logstash_ruby_exception'] = 'underscores: ' + e.message
end
与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…