Skip to content

Commit

Permalink
Setup mtail
Browse files Browse the repository at this point in the history
  • Loading branch information
link2xt committed Aug 1, 2024
1 parent e7a9bf2 commit 2bb5942
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 0 deletions.
11 changes: 11 additions & 0 deletions cmdeploy/src/cmdeploy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -635,3 +635,14 @@ def deploy_chatmail(config_path: Path) -> None:
name="Ensure cron is installed",
packages=["cron"],
)

mtail_conf = files.put(
name="Mtail configuration",
src=importlib.resources.files(__package__).joinpath(
"mtail/delivered_mail.mtail"
),
dest="/etc/mtail/delivered_mail.mtail",
user="root",
group="root",
mode="644",
)
44 changes: 44 additions & 0 deletions cmdeploy/src/cmdeploy/mtail/delivered_mail.mtail
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
counter delivered_mail
/saved mail to INBOX$/ {
delivered_mail++
}

counter quota_exceeded
/Quota exceeded \(mailbox for user is full\)$/ {
quota_exceeded++
}

# Essentially the number of outgoing messages.
counter dkim_signed
/DKIM-Signature field added/ {
dkim_signed++
}

counter created_accounts
counter created_ci_accounts
counter created_nonci_accounts

/: Created address: (?P<addr>.*)$/ {
created_accounts++

$addr =~ /ci-/ {
created_ci_accounts++
} else {
created_nonci_accounts++
}
}

counter postfix_timeouts
/timeout after DATA/ {
postfix_timeouts++
}

counter postfix_noqueue
/postfix\/.*NOQUEUE/ {
postfix_noqueue++
}

counter warning_count
/warning/ {
warning_count++
}

0 comments on commit 2bb5942

Please sign in to comment.