Documentation / LemmeKnow Server

Log file formats

A format says how a log file's text is split into entries. The same formats, from the same code, are used by Autologger, which sends each entry as a log line, and by file feeds on the LemmeSee Hub, which keep entries as feed items. Four formats are built in, and you can add your own.

Every entry has a title, a level, a time, and optionally detail lines, each with its own level. Autologger puts the detail lines under the title in one message; a feed shows them as the item's body.

Raw

Each non-empty line is one entry at info, with no detail lines, timed when it was read.

Backup started
Backup finished

LK Log

Each line has a timestamp, a source, and a message. Lines that share a source and run id are one entry: the first line is the title and the rest are its detail lines.

[2026-05-01 02:00:04] [backup:run42] Nightly backup started
[2026-05-01 02:00:09] [backup:run42] dropped: C:\pagefile.sys
[2026-05-01 02:00:20] [backup:run42] 12 folders copied
[2026-05-01 02:01:00] [cleanup] Temp folder emptied
  • The source part is source:run_id. The entry's source is the part before the colon, so the first three lines above are one entry from backup.
  • The run id is any text that marks one run of a job, such as a run number or a start time, so each run becomes its own entry even when the same job logs every night.
  • A line whose source has no run id, like [cleanup], is an entry on its own.
  • The entry's time is its first line's timestamp.
  • A line whose message starts with dropped: is warning, and so is its whole entry. Everything else is debug.

Tab Body

A line starting with a timestamp and a level tag starts an entry. The tab-indented lines after it are its detail lines.

[2026-05-01 02:00:04] [INFO] Nightly backup finished
	12 folders copied
	[WARNING] 3 files skipped (in use)
[2026-05-02 02:00:05] [ERROR] Nightly backup failed
	Destination drive not found
  • The timestamp is [YYYY-MM-DD HH:MM:SS], in the PC's local time. It becomes the entry's time.
  • The level tag is [ERROR], [WARNING] (or [WARN]), [IMPORTANT], [INFO], or [DEBUG]. A title without a tag, or with an unknown one, is debug.
  • A detail line can start with its own tag. Untagged detail lines are debug.
  • Only the title sets the entry's level. A tag on a detail line, like [WARNING] above, doesn't change it: in the app the entry stays at its title's level, so the first entry above is info for rules and colours. On a hub feed the tagged line is coloured inside the item's body; with Autologger it keeps the tag as text. To make the whole entry a warning, tag its title.
  • Lines that are neither, and indented lines before the first entry, are skipped.

JUnit XML

A JUnit XML results file, as written by most test runners. Each <testsuite> is one entry:

  • The title is PASS or FAIL, the suite name, its time, and how many tests ran, failed, and were skipped.
  • The entry is error when any test failed or errored, otherwise debug.
  • Each test case is a detail line. A failure is error and includes its message and trace, a skipped test is warning, and a passing test is debug unless the feed or Autologger entry sets default_body_level to another level.

A JUnit file is read whole each time it changes, since test runners rewrite it rather than add to it.

Custom formats

A custom format is a Python file named after the format, such as csvlog.py, with a parse(text) function that returns a list of entries:

def parse(text):
    entries = []
    for line in text.splitlines():
        if not line.strip():
            continue
        level, message = line.split(",", 1)
        entries.append({"title": message, "level": level})
    return entries

Each entry is a dictionary:

KeyRequiredMeaning
titleYesThe entry's main line. Entries without one are skipped.
levelNodebug, info, warning, important, or error. Default info.
tsNoTime in milliseconds since 1970. Default: when it was read.
contentNoDetail lines: a list of {"text": ..., "level": ...}, or plain text.
sourceNoSource name, which overrides the configured one.
idNoA stable id, used by feeds to tell entries apart. Default: made from the entry's time, title, and content.

parse is given only the new text since the last read, except for a file that started over, so an entry should not depend on lines from an earlier read. To accept the configured default_body_level too, define parse(text, default_body_level).

Put the file in the custom formats folder, then use its name, without .py, as the format:

  • Autologger: custom_formats next to autologger_config.py, or the folder named by FORMATS_PATH in that config.
  • LemmeSee Hub: the folder named by formats_path in config.json. Custom formats appear in the feed form's Format list.

Names use lowercase letters, digits, and underscores, and can't reuse a built-in name. A changed file is picked up without restarting. If the file fails to load, or parse raises an error, that read gives no entries and the error is printed. A format name with no file behind it is read as Raw.

A custom format is code that runs inside Autologger or the hub, with the same access as they have, the same as plugins and filter scripts. Only add format files you trust.