bpaquet/node-logstash — pull request #17 by dax (2012-12-19 14:41:14+00:00)
Title: Add a way to ignore empty fields

This PR add a way to ignore empty parsed fields.

For example, a log line might have a numeric value or a dash:

((\\d+)|-)

To avoid sending `-` to Elasticsearch and use numeric indexes, the field which will receive the parsed value must be a numeric value or must not be sent to Elasticsearch.

The associated fields must be added twice into the fields list:

value,value

The first time, it will match the whole expression (i.e. a numeric value or `-`), the second time it will match the numeric value or will be undefined if `-` is present. In that later case, we delete the first matched field.