Skip to main content

scietex.log_aggregator_service

scietex.log_aggregator_service is a scietex.service worker that merges the per-worker log streams of the configured services into one shared stream. Each scietex.service worker writes its own stream (scietex:{service}:{instance_id}:log); this service tails all of them and copies every entry into a single target stream (scietex:log by default), stamping each entry with a source field ({service}:{instance_id}) so consumers can tell which worker emitted it.

The aggregator is the sole writer of the target stream, so it owns both the MAXLEN ~ trim and the whole-key EXPIRE. The API backend reads that stream for the system log viewer and no longer trims it.

Python ≥ 3.10 · License: MIT

How it works

per-worker log streams                     shared stream                viewer
scietex:{svc}:{inst}:log  ─┐
scietex:{svc2}:{inst}:log  ─┤  XREAD (multi-key)   ┌────────────────┐   GET /logs/          ─► LogViewer
scietex:{svcN}:{inst}:log  ─┘ ───────────────►    │ scietex:log    │   GET /logs/stream (SSE)   (Source col)
                                                   │ XADD MAXLEN ~  │
   ▲ each writer owns its stream                   │ EXPIRE ttl     │
   │ (worker heartbeat refreshes its TTL)          └────────────────┘
                                                   ▲ single owner
                                   ┌───────────────┴────────────────┐
                                   │ LogAggregatorService worker     │
                                   │ (reads scietex:{agg}:config)    │
                                   └─────────────────────────────────┘
  • A single supervisor loop (not one task per stream) tails every source with a multi-key XREAD, so the merge is natural and there is no task fan-out.
  • A periodic SCAN (scietex:{service}:*:log) picks up workers that appear or disappear; the source set is rebuilt in place.
  • The target stream's TTL is refreshed on a timer (Valkey EXPIRE sets a TTL on the key; XADD does not refresh it).
  • The aggregator's own service is excluded from the source set, so its logs do not loop back into the stream it writes.

Installation

pip install scietex.log_aggregator_service

This pulls in scietex.service[valkey] (the worker framework and its Valkey transport).

Quick start

1. Write a configuration file

The service reads log_aggregator.yml from a log_aggregator/ subdirectory of its config directory. Create it by hand, or let the service generate defaults on first run:

source_services:
  - ModbusService
exclude_services:
  - LogAggregatorService
target_stream: scietex:log
max_len: 100000
ttl_seconds: 604800
batch_size: 200
block_ms: 1000
scan_interval: 15.0

2. Run the service

start-log-aggregator --conf-dir /etc/scietex

The service resolves its config directory automatically when --conf-dir is omitted. It runs in the foreground until it receives SIGINT or SIGTERM.

3. Register it with the backend

The backend is the config authority: register the service so it can deliver the log_aggregator section (source services, target stream, max_len, ttl):

curl -X POST http://localhost:8000/api/v1/services/discovered/LogAggregatorService/register

Configuration at a glance

Setting Default Meaning
source_services [] Service names whose per-worker log streams are aggregated
exclude_services [] Names removed from the source set (self-exclusion)
target_stream scietex:log Shared stream the aggregator writes
max_len 100000 MAXLEN ~ applied on each write (0 disables)
ttl_seconds 604800 Whole-key TTL refreshed on a timer (0 disables)
batch_size 200 Entries per XREAD
block_ms 1000 XREAD block timeout
scan_interval 15.0 Seconds between source-set SCANs

Development

Dependencies are managed with uv; checks and tests run through tox:

uv sync --all-extras
uv run tox                    # format, lint, type, py314
uv run tox -e py314           # tests only

Metadata

Release files for scietex.log-aggregator-service 0.1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for scietex.log-aggregator-service 0.1.2
File Size Uploaded
scietex_log_aggregator_service-0.1.2.tar.gz 15.8 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for scietex.log-aggregator-service 0.1.2
File Interpreter ABI Platform
scietex_log_aggregator_service-0.1.2-py3-none-any.whl Python 3 none any Details

Total release size: 28.3 kB

Release files / scietex_log_aggregator_service-0.1.2.tar.gz

Download URL scietex_log_aggregator_service-0.1.2.tar.gz
Size 15.8 kB
Tags Source
SHA-256 checksum
How to use checksums
60f64f31cea46c9738b9f4e6a32a67f7042c6f247ae65acb4e1b808ec0cc7e88
BLAKE2b-256 checksum
How to use checksums
29f1cf0855c2d07da1b6b59823f3ef8e4fd4e61409ee36a70ef21a99023b8b36
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release files / scietex_log_aggregator_service-0.1.2-py3-none-any.whl

Download URL scietex_log_aggregator_service-0.1.2-py3-none-any.whl
Size 12.5 kB
Tags Python 3
SHA-256 checksum
How to use checksums
b5c8cafbe1b4f846108bc0d0c1d22a298bdf95d7a3782768497dcbc005b44e0a
BLAKE2b-256 checksum
How to use checksums
bc48e00c4febbfb9be75cc7a98f62f434785e1257c6e36dc3a17b912a2e576b4
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
Yes
Uploaded via twine/7.0.0 CPython/3.13.14

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

PyPI Publish Attestation

PyPI verified that this artifact, at this checksum, originated from the publisher listed below.

Signed by GitHub Actions, verified by PyPI on Oct 8, 2026.

Transparency log

Release history Release notifications | RSS feed

This release

0.1.2 This release

2 release files

0.1.1

2 release files

0.1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page