Get log

Fetch logs for API (and subsequently GUI which is built on top of the API)

  • HTTP Method: GET
  • URL: https://example.domain.tld/api/v1/log/
  • Require authentication: Yes
  • Permission level required: MasterAdmin / DomainAdmin / MailUser

Query parameters

Parameter Type Description Required
limit int Number of records (max 50) Optional
start int Record offset Optional
search str Search log message Optional

Response parameters

Parameter Type Description
log list List of all log events
authenticated_user str User who made the request
datetime int Time of request as UNIX timestamp (seconds)
level str Logging level
logger str Logger unit
message str Log message
modified_user str User who was modified by the request (if applicable)

Example request (Python)

import requests
import json
from pprint import pprint

url = "https://example.domain.tld/api/v1/log/?limit=3&start=0" # example using query parameters to fetch latest 3 log events
r = requests.get(url, auth=("admin","long-auth_token-here"))
try:
    pprint(r.json())
except:
    print(r.text)

Example response (JSON)

{'log': [{'authenticated_user': 'admin',
          'datetime': 1583891505,
          'level': 'INFO',
          'logger': 'nms.accounts',
          'message': 'Added user',
          'modified_user': 'sam'},
         {'authenticated_user': 'admin',
          'datetime': 1583891505,
          'level': 'INFO',
          'logger': 'nms.auth',
          'message': 'Authorization obtained',
          'modified_user': 'admin'},
         {'authenticated_user': 'john',
          'datetime': 1583871486,
          'level': 'INFO',
          'logger': 'nms.antispam_wlbl',
          'message': 'Added whitelist rule for domain vonmail.com',
          'modified_user': 'john'}]}