logstash/logstash — pull request #240 by pyrho (2012-11-12 11:44:00+00:00)
Title: Prevent field creation on filter operating on non-existent fields

Hi !

I created a filter to convert a field I has from string to integer.
The issue what that if my field didn't exist, the convert filter would create the field with an empty value.

Example:

If my input is:
```javascript
{"@source":"default","@tags":[],"@fields":{},"level":"info","message":"Got remotetime 1352395395839","timestamp":"2012-11-08T17:23:15.871Z","@timestamp":"2012-11-08T17:23:16.061Z","@message":"json_event","@source_host":null,"@source_path":"default","@type":"redis-input"}
```

And my filter is:
```ruby
filter{
mutate{
convert => ["ThisFieldDoesntExist", "integer"]
}
}
```

The output would have been:
```javascript
{"@source":"default","@tags":[],"@fields":{},"level":"info","message":"Got remotetime 1352395395839","timestamp":"2012-11-08T17:23:15.871Z","@timestamp":"2012-11-08T17:23:16.061Z","@message":"json_event","@source_host":null,"@source_path":"default","@type":"redis-input", "ThisFieldDoesntExist":"0"}
```

Because ```event[ThisFieldDoesntExist]``` is ```nil``` and that nil converts to "0" in ruby apparently.

I am no ruby expert so my fix may be shitty ^^

Thanks for logstash !