Skip to content

Releases: rfxn/tlog_lib

v2.0.4

16 Mar 08:43

Choose a tag to compare

Bug Fixes

  • Replace bare rm/mv with command rm/command mv in tlog_lib.sh and tlog CLI for shell alias safety on all target platforms
  • Add inline comments to all 2>/dev/null and || true suppressions per shell standards convention

Full Changelog: v2.0.3...v2.0.4

tlog_lib v2.0.2

04 Mar 04:41

Choose a tag to compare

tlog_lib v2.0.2

New Features

  • CLI version cross-check — warns when tlog and tlog_lib.sh versions diverge after sourcing
  • Baserun advisory warnings — library warns when baserun directory is world-writable; CLI warns when running as root with default /tmp cursor storage; non-fatal, directs to -b/--baserun
  • Journal flock supporttlog_journal_read() supports optional cursor locking via TLOG_FLOCK=1; returns exit 4 on contention
  • 67 new BATS tests (129 → 196 total)

Bug Fixes

  • Rotation pipe fallback — when mktemp fails or decompression write fails, fall back to pipe-based decompression instead of silently dropping rotated content
  • Baserun directory validation — validated before processing in tlog_read(), tlog_journal_read(), and tlog_advance_cursors()
  • Arithmetic input validationSCAN_MAX_LINES, SCAN_TIMEOUT, and max_lines arguments validated; non-numeric values default to 0 with stderr warning
  • --status subcommand — correctly display corrupt cursor state with raw content for diagnosis; add exit code note to help text
  • --reset subcommand — clean up orphaned journal timestamp temp files alongside cursor temp files
  • README — document return codes for journal read functions

Changes

  • Extract rotation into _tlog_handle_rotation() helper; decompress once to temp file
  • Internal code cleanup: consolidate duplicated helpers, remove CLI/library function collision, add stderr warnings on cursor write failures
  • CLI --first-run flag validates value (must be skip or full)
  • CI and test infrastructure: lint gating, bash -n in CI, dynamic version assertions, test dedup

Full Changelog

See CHANGELOG

tlog_lib v2.0.1

27 Feb 22:42

Choose a tag to compare

tlog_lib v2.0.1 — Incremental Log Reader for Bash

Shared Bash library for cursor-based incremental log file reading with multi-mode tracking, rotation-aware delta reads, systemd journal fallback, and atomic cursor writes.

Highlights

  • Two tracking modes — byte-offset (tail -c) for throughput or line-count (tail -n) for whole-line output
  • Log rotation aware.1 and compressed variants (.gz, .xz, .bz2, .zst, .lz4) with runtime tool detection; supports both create and copytruncate logrotate strategies
  • Atomic cursor writesmktemp + mv -f ensures cursors never corrupt on crash
  • Optional flock locking — prevents cursor races between cron and daemon
  • Standalone CLItlog wrapper with option flags, subcommands (--full, --status, --reset, --adjust), and backward-compatible positional interface
  • Cursor validation — regex check, auto-reset on corruption, path traversal rejection, mode validation
  • 133 BATS tests across 9 OS targets (CentOS 6 through Rocky 10)
  • Zero external dependencies beyond POSIX coreutils

Changelog

See CHANGELOG.RELEASE for the full tagged entry list (13 [New], 4 [Fix]).

Platform Support

Distribution Versions Bash
CentOS 6, 7 4.1, 4.2
Rocky Linux 8, 9, 10 4.4, 5.1, 5.2
Debian 12 5.2
Ubuntu 12.04, 14.04, 20.04, 24.04 4.2–5.2

Minimum: Bash 4.1 (CentOS 6, 2011). No Bash 4.2+ features used.