Interactive TUI and non-interactive CLI helper for exploring SmarterMail logs on Linux servers
Project description
sm-logtool
sm-logtool is a terminal-first log explorer for SmarterMail logs. It ships
with:
- A Textual wizard UI (
browse) for interactive searching. - A console search command (
search) for quick scripted checks. - Log staging that copies or unzips source logs before analysis.
- Conversation/entry grouping for supported SmarterMail log kinds.
- Syntax-highlighted results in both TUI and CLI output.
Requirements
- Python 3.10+
- Linux (project classifiers currently target POSIX/Linux)
Deployment Model
sm-logtool does not require installation on the same host as SmarterMail,
but it is designed for that workflow. In practice, you typically SSH to the
mail server and run searches there.
The tool stages logs into a separate working directory so the original SmarterMail logs remain untouched during analysis and sub-searches.
Install
Install from this repository:
python -m venv .venv
source .venv/bin/activate
python -m pip install -e .
This installs the sm-logtool command and allows python -m sm_logtool.cli.
Configuration
Configuration is YAML with these keys:
logs_dir: source SmarterMail logs directory.staging_dir: working directory used for copied/unzipped logs.default_kind: default log kind (for examplesmtp).
Example:
logs_dir: /var/lib/smartermail/Logs
staging_dir: /var/tmp/sm-logtool/logs
default_kind: smtp
If staging_dir does not exist yet, the app creates it automatically.
Config resolution order:
--config /path/to/config.yamlSM_LOGTOOL_CONFIG~/.config/sm-logtool/config.yaml
When the default path is used and the file does not exist, sm-logtool
creates it automatically with SmarterMail-oriented defaults.
Usage
Top-level help:
sm-logtool --help
Launch the TUI
sm-logtool
# or
sm-logtool browse --logs-dir /var/lib/smartermail/Logs
Wizard flow:
- Choose log kind.
- Select one or more log dates.
- Enter search term.
- Review results, copy selection/all, and optionally run sub-search.
Global shortcuts shown in the footer:
Ctrl+QquitCtrl+Rreset search stateCtrl+Ffocus search input (when search step is active)Ctrl+Uopen command palette/menu
Date selection shortcuts:
- Arrow keys to move
Spaceto toggle a dateEnterto continue
Run console search
sm-logtool search --kind smtp --date 2024.01.01 "example.com"
Minimum examples:
# Search newest log for default_kind from config.yaml (default: smtp)
sm-logtool search "john@prime42.net"
# Search newest delivery log
sm-logtool search --kind delivery "john@prime42.net"
Target resolution:
- If
--log-fileis provided (repeatable), those files are searched. - Else if
--dateis provided (repeatable), those dates are searched. - Else the newest available log for
--kindis searched.
Search options:
--logs-dir: source logs directory. Optional whenlogs_diris set inconfig.yaml.--staging-dir: staging directory. Optional whenstaging_diris set inconfig.yaml.--kind: log kind. Optional whendefault_kindis set inconfig.yaml.--date:YYYY.MM.DDdate to search. Repeat to search multiple dates.--log-file: explicit file to search. Repeat to search multiple files.--list: list available logs for the selected kind and exit.--list-kinds: list supported kinds and exit.--case-sensitive: disable default case-insensitive matching.
Search terms are literal substrings (regex/fuzzy modes are not enabled in the current CLI/TUI search path).
Supported Log Kinds
Search handlers currently exist for:
smtp,imap,popdeliveryadministrativeimapretrievalactivation,autocleanfolders,calendars,contentfilter,event,generalerrors,indexing,ldap,maintenance,profiler,spamchecks,webdav
Log discovery expects SmarterMail-style names such as:
YYYY.MM.DD-kind.log or YYYY.MM.DD-kind.log.zip.
Development
Run tests with both frameworks used in this repository:
pytest -q
python -m unittest discover test
Additional Docs
License
This project is licensed under AGPL-3.0. See LICENSE.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file sm_logtool-0.9.1.tar.gz.
File metadata
- Download URL: sm_logtool-0.9.1.tar.gz
- Upload date:
- Size: 50.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
d77d12c65d7a56cf172e311242e1c9be06bf9a53e337b2c7cbccda1d7c6bb941
|
|
| MD5 |
9d9cf96de1403c4305f642cb10c2bd41
|
|
| BLAKE2b-256 |
7ac705a7c9888fa2c5bb5bbac7e76ea4bb2041f3ec29b2141dfb592604f98a6e
|
Provenance
The following attestation bundles were made for sm_logtool-0.9.1.tar.gz:
Publisher:
publish.yml on T313C0mun1s7/sm-logtool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sm_logtool-0.9.1.tar.gz -
Subject digest:
d77d12c65d7a56cf172e311242e1c9be06bf9a53e337b2c7cbccda1d7c6bb941 - Sigstore transparency entry: 944714048
- Sigstore integration time:
-
Permalink:
T313C0mun1s7/sm-logtool@9ca43083281b4207105312aa0746d654a5ad27f0 -
Branch / Tag:
refs/tags/v0.9.1 - Owner: https://github.com/T313C0mun1s7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ca43083281b4207105312aa0746d654a5ad27f0 -
Trigger Event:
release
-
Statement type:
File details
Details for the file sm_logtool-0.9.1-py3-none-any.whl.
File metadata
- Download URL: sm_logtool-0.9.1-py3-none-any.whl
- Upload date:
- Size: 47.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: twine/6.1.0 CPython/3.13.7
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
937135399937e2a7d2938e599c754720bf1f2056e2ef382f6027dd593da32fe8
|
|
| MD5 |
7f501984ed7cc1d7f899d11f8ccf296f
|
|
| BLAKE2b-256 |
3b51cd829448ca6ec6f6166f74ec9e6f1670ebff5a22b17f8df01b31648dbbad
|
Provenance
The following attestation bundles were made for sm_logtool-0.9.1-py3-none-any.whl:
Publisher:
publish.yml on T313C0mun1s7/sm-logtool
-
Statement:
-
Statement type:
https://in-toto.io/Statement/v1 -
Predicate type:
https://docs.pypi.org/attestations/publish/v1 -
Subject name:
sm_logtool-0.9.1-py3-none-any.whl -
Subject digest:
937135399937e2a7d2938e599c754720bf1f2056e2ef382f6027dd593da32fe8 - Sigstore transparency entry: 944714069
- Sigstore integration time:
-
Permalink:
T313C0mun1s7/sm-logtool@9ca43083281b4207105312aa0746d654a5ad27f0 -
Branch / Tag:
refs/tags/v0.9.1 - Owner: https://github.com/T313C0mun1s7
-
Access:
public
-
Token Issuer:
https://token.actions.githubusercontent.com -
Runner Environment:
github-hosted -
Publication workflow:
publish.yml@9ca43083281b4207105312aa0746d654a5ad27f0 -
Trigger Event:
release
-
Statement type: