-
-
Save strarsis/3305701edad9c8799f16a0fd20f79ff1 to your computer and use it in GitHub Desktop.
my logstash.conf file for postfix
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
input { | |
file { | |
path => "/var/log/maillog*" | |
exclude => "*.gz" | |
start_position => "beginning" | |
type => "maillog" | |
} | |
} | |
filter { | |
if [type] == "maillog" { | |
grok { | |
patterns_dir => ["/home/logstash/config/patterns"] | |
match => { "message" => ["%{PF}", "%{DOVECOT}" ] } | |
} | |
date { | |
match => [ "timestamp", "MMM dd HH:mm:ss", "MMM d HH:mm:ss" ] | |
} | |
} | |
# I wanted to monitor metrics and health of logstash | |
metrics { | |
meter => "events" | |
add_tag => "metric" | |
} | |
} | |
output { | |
if [type] == "maillog" { | |
elasticsearch { | |
index => "maillog-%{+YYYY.MM.dd}" | |
host => "localhost" | |
port => "9200" | |
protocol => "http" | |
flush_size => 1000 | |
manage_template => true | |
template_overwrite => true | |
template => "/home/logstash/config/templates/maillog.json" | |
template_name => "maillog" | |
} | |
} | |
if "metric" in [tags] { | |
stdout { | |
codec => line { | |
format => "rate: %{events.rate_1m}" | |
} | |
} | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment