I'm trying to add a custom pattern to Logstash in order to capture data from this kind of log line:
[2017-11-27 12:08:22] production.INFO: {"upload duration":0.16923}
I followed the instructions on Logstash guide for grok and created a directory called patterns with a file in it called extra that contain:
POSTFIX_UPLOAD_DURATION upload duration
and added the path to the config file:
grok {
patterns_dir => ["./patterns"]
match => { "message" => "\[%{TIMESTAMP_ISO8601:timestamp}\] %{POSTFIX_UPLOAD_DURATION: upload_duration} %{DATA:log_env}\.%{LOGLEVEL:severity}: %{GREEDYDATA:log_message}" }
}
However, I'm getting this error message:
Pipeline aborted due to error {:exception=>#<Grok::PatternError: pattern %{POSTFIX_UPLOAD_DURATION: upload_duration} not defined>
Also, some log lines don't contain the 'upload duration' field, will this break the pipeline?