{"action":"created","issue":{"url":"https://api.github.com/repos/elastic/logstash/issues/4105","labels_url":"https://api.github.com/repos/elastic/logstash/issues/4105/labels{/name}","comments_url":"https://api.github.com/repos/elastic/logstash/issues/4105/comments","events_url":"https://api.github.com/repos/elastic/logstash/issues/4105/events","html_url":"https://github.com/elastic/logstash/issues/4105","id":113912064,"number":4105,"title":"LogStash::Event should not allow nil keys!","user":{"login":"andrewvc","id":131427,"avatar_url":"https://avatars.githubusercontent.com/u/131427?v=3","gravatar_id":"","url":"https://api.github.com/users/andrewvc","html_url":"https://github.com/andrewvc","followers_url":"https://api.github.com/users/andrewvc/followers","following_url":"https://api.github.com/users/andrewvc/following{/other_user}","gists_url":"https://api.github.com/users/andrewvc/gists{/gist_id}","starred_url":"https://api.github.com/users/andrewvc/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/andrewvc/subscriptions","organizations_url":"https://api.github.com/users/andrewvc/orgs","repos_url":"https://api.github.com/users/andrewvc/repos","events_url":"https://api.github.com/users/andrewvc/events{/privacy}","received_events_url":"https://api.github.com/users/andrewvc/received_events","type":"User","site_admin":false},"labels":[{"url":"https://api.github.com/repos/elastic/logstash/labels/bug","name":"bug","color":"e11d21"},{"url":"https://api.github.com/repos/elastic/logstash/labels/crashes","name":"crashes","color":"e11d21"},{"url":"https://api.github.com/repos/elastic/logstash/labels/design","name":"design","color":"eb6420"}],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":12,"created_at":"2015-10-28T20:11:53Z","updated_at":"2015-10-28T21:17:25Z","closed_at":null,"body":"Currently, it is possible to create an event with nil keys using the following code `LogStash::Event.new(nil => 123)`. This should fail! It really screws with things like the Elasticsearch output.\r\n\r\nThe accessor `[]` does not have this error, but should raise a better error message (it just happens to fail by trying to invoke `nil.starts_with?`."},"comment":{"url":"https://api.github.com/repos/elastic/logstash/issues/comments/151992619","html_url":"https://github.com/elastic/logstash/issues/4105#issuecomment-151992619","issue_url":"https://api.github.com/repos/elastic/logstash/issues/4105","id":151992619,"user":{"login":"colinsurprenant","id":2010,"avatar_url":"https://avatars.githubusercontent.com/u/2010?v=3","gravatar_id":"","url":"https://api.github.com/users/colinsurprenant","html_url":"https://github.com/colinsurprenant","followers_url":"https://api.github.com/users/colinsurprenant/followers","following_url":"https://api.github.com/users/colinsurprenant/following{/other_user}","gists_url":"https://api.github.com/users/colinsurprenant/gists{/gist_id}","starred_url":"https://api.github.com/users/colinsurprenant/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/colinsurprenant/subscriptions","organizations_url":"https://api.github.com/users/colinsurprenant/orgs","repos_url":"https://api.github.com/users/colinsurprenant/repos","events_url":"https://api.github.com/users/colinsurprenant/events{/privacy}","received_events_url":"https://api.github.com/users/colinsurprenant/received_events","type":"User","site_admin":false},"created_at":"2015-10-28T21:17:25Z","updated_at":"2015-10-28T21:17:25Z","body":"AFAIK this hasn't been a very common problem, so as a pragmatic short-term solution I suggest we simply add an event cleaner plugin or a new mutate function to remove nil keys? \r\n\r\nalso, could we better trap these nil keys errors/exceptions and reject+log the offending event? "}}