kumina / postfix_exporter

A Prometheus exporter for Postfix.
Apache License 2.0
235 stars 136 forks source link

Support for submission/smtpd #76

Open basos9 opened 3 years ago

basos9 commented 3 years ago

It is a common practice to implement a smtpd on port 587 for the submission service. The naming is defined from the configuration on the master.cf

for example

submission inet n       -       -       -       -       smtpd
  -o syslog_name=postfix/submission

produces the log

Απρ 15 12:20:28 mx2 postfix/submission/smtpd[6833]: Anonymous TLS connection established from  xx[5.5.5.5]: TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)

These could be reported along with smtpd or in a seperate submission prefix.

olvsa commented 2 years ago

Moreover, in case of multiple postfix instances log line may contain not "postfix" but "postfix-instance" (postfix-mx in my example).

master.cf snipped:

content-filter unix -    -       y       -       2       smtp
 -o syslog_name=${multi_instance_name?{$multi_instance_name}:{postfix}}/$service_name

log line looks like Nov 08 08:08:59 mx postfix-mx/content-filter/smtp[273144]: 4HnkK60lBRz6tl1: to=<a@b.c>, relay=192.168.1.1[192.168.1.1]:20202, delay=1.9, delays=1.7/0/0.05/0.18, dsn=2.0.0, status=sent (250 2.0.0 from MTA(smtp:[192.168.1.2]:10025): 250 2.0.0 Ok: queued as 4HnkK74hXyz6tl6)

so neither regex from 0.3 nor from 0.2 does not catch them v0.2: logLine = regexp.MustCompile(` ?postfix/(\w+)\[\d+\]: (.*)`) v0.3: logLine = regexp.MustCompile(` ?(postfix|opendkim)(/(\w+))?\[\d+\]: (.*)`)

Subito commented 2 years ago

This should be fixed by #88 if you want to give it a try

1kUHuiswkvj7spRO commented 3 months ago

Having the same issue here. I have not tried the PR @Subito. I don't think it will ever be merged in?

Subito commented 3 months ago

Having the same issue here. I have not tried the PR @Subito. I don't think it will ever be merged in?

Probably not. I'm still using the fork which contains #88 and it works fine for us.