Skip to content

fix(logs): discover macOS log sources with portable find - #384

Merged
GOODBOY008 merged 2 commits into
GOODBOY008:mainfrom
sunxiaobin89:fix/macos-log-sources
Dec 2, 2026
Merged

GOODBOY008 merged 2 commits into
GOODBOY008:mainfrom
sunxiaobin89:fix/macos-log-sources

Conversation

@sunxiaobin89

Copy link
Copy Markdown
Contributor

Summary

Fixes #378. Log Monitor found no sources on macOS: find ... -readable is a GNU extension, BSD find rejects the whole expression with unknown primary or operator, and stderr was discarded — indistinguishable from "no logs".

  • Build the discovery command with a flag: GNU form with -readable first, portable form without it as fallback.
  • Linux keeps its permission-filtered behaviour; macOS now lists /var/log/system.log and friends.
  • The retry only runs when the first pass returns nothing, so Linux hosts don't pay an extra round-trip in the normal case.

Test plan

  • cargo test --lib log_discovery_command — 2 passed.
  • Verified on macOS: the -readable form prints find: -readable: unknown primary or operator; the portable form lists /var/log/system.log, /var/log/install.log, etc.

The /var/log discovery command used the GNU-only -readable primary. BSD find rejects it with "unknown primary or operator" and stderr was discarded, so macOS hosts always reported no log sources. Try the GNU form first, then retry without -readable.

Fixes GOODBOY008#378
@GOODBOY008
GOODBOY008 merged commit 89bbc2b into GOODBOY008:main Dec 2, 2026
4 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Log Monitor discovers no log sources on macOS

2 participants