Get logs

Get server logs for postfix (SMTP server), dovecot (IMAP/POP server), or fail2ban (abusive IP blocker).

  • HTTP Method: GET
  • URL: https://example.domain.tld/api/v1/server/logs/<service>/
  • Require authentication: Yes
  • Permission level required: MasterAdmin

Path parameters

Parameter Type Description Required
service str postfix / dovecot / fail2ban Required

Response

HTTP 200. Requested log (latest 10000 lines) as UTF-8 encoded text, text/html mimetype.

Example request (Python)

import requests
import json
from pprint import pprint

url = "https://example.domain.tld/api/v1/server/logs/postfix/"
r = requests.get(url, auth=("admin","long-auth_token-here"))
try:
    pprint(r.json())
except:
    print(r.text)

Example response (text)

Mar 11 04:04:54 mail3 postfix/smtpd[32624]: connect from unknown[45.125.65.35]
Mar 11 04:04:57 mail3 postfix/smtpd[32624]: warning: unknown[45.125.65.35]: SASL LOGIN authentication failed: UGFzc3dvcmQ6
Mar 11 04:04:57 mail3 postfix/smtpd[32624]: disconnect from unknown[45.125.65.35] ehlo=1 auth=0/1 quit=1 commands=2/3
...