I found Tin Le's setup on Linked In, and I think it looked really nice, so I wanted to add those logfiles to our ELK as well.
I've created the patterns file, and modified my logstash.con, I'll be getting the logfiles with filebeat, so it's a bit different than Tin Le's.
I'm trying to add the template, but I get an error:
curl -X PUT "elasticsearch:9200/_template/postfix" -H 'Content-Type: application/json' -d '{
"template" : "maillog-*",
"order" : 1,
"settings" : {
"number_of_shards" : 2,
"index.refresh_interval" : "90s"
},
"mappings" : {
"maillog" : {
"properties" : {
"reason" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"saslusername" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"postfix_action" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"relayip" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"messageid" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"pid" : { "index": "not_analyzed", "doc_values": true, "type" : "long" },
"remote" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"type" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"qid" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"local" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"result" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"path" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"file" : { "index": "not_analyzed", "type" : "string" },
"queuestatus" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"smtp_response" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"@version" : { "type" : "string" },
"host" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"client" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"from" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"timestamp" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"nrcpt" : { "index": "not_analyzed", "doc_values": true, "type" : "long" },
"responsecode" : { "index": "not_analyzed", "doc_values": true, "type" : "long" },
"offset" : { "index": "not_analyzed", "doc_values": true, "type" : "long" },
"relayhost" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"logsource" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"message" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"orig_to" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"command" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"tags" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"helo" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"saslmethod" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"component" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"@timestamp" : { "format" : "dateOptionalTime", "type" : "date" },
"remotehost" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"size" : { "index": "not_analyzed", "doc_values": true, "type" : "long" },
"anvilstatistic" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"proto" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"bouncequeueid" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"to" : { "index": "not_analyzed", "doc_values": true, "type" : "string" },
"dsn" : { "index": "not_analyzed", "doc_values": true, "type" : "string" }
}
}
}
}'
That gave me this error:
{"error":{"root_cause":[{"type":"mapper_parsing_exception","reason":"No handler for type [string] declared on field [reason]"}],"type":"mapper_parsing_exception","reason":"Failed to parse mapping [maillog]: No handler for type [string] declared on field [reason]","caused_by":{"type":"mapper_parsing_exception","reason":"No handler for type [string] declared on field [reason]"}},"status":400}[
Ignoring that, and sending the logfiles to logstash with filebeat, it is imported, but not interpreted.
A few logline examples from our mailservers:
Jan 22 10:53:42 alpha55002 postfix/smtp[23919]: 14117807B898: host gmail-smtp-in.l.google.com[108.177.127.27] said: 421-4.7.0 This message does not have authentication information or fails to pass 421-4.7.0 authentication checks. To best protect our users from spam, the 421-4.7.0 message has been blocked. Please visit 421-4.7.0 https://support.google.com/mail/answer/81126#authentication for more 421 4.7.0 information. s12-v6si1426609ejd.277 - gsmtp (in reply to end of DATA command)
Jan 22 10:53:45 alpha55002 postfix/smtp[23919]: Untrusted TLS connection established to alt1.gmail-smtp-in.l.google.com[74.125.24.27]:25: TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)