Repository navigation
Conversation
Codecov Report❌ Patch coverage is
📢 Thoughts on this report? Let us know! |
spawn's audit logger wrote one JSON record per operation (with the AWS account ID as user_id) straight to stderr, and Go log diagnostics from library code (pricing, etc.) went to stderr with timestamps, so both interleaved with launch progress output. spored status likewise printed the query agent's init and idle-check log lines. - Audit trail: appended to ~/.spawn/audit.log (0600, opened lazily), copied to stderr under --verbose; falls back to stderr if the file cannot be opened so no record is lost. - Go log: routed to ~/.spawn/spawn.log via cobra.OnInitialize, copied to stderr under --verbose. - Actionable warnings previously sent through log.Printf (no price, unverified plugin, untagged bucket, ...) now print to stderr directly so they stay visible; burst progress lines likewise. - spored status: agent log lines discarded unless --verbose; spawn status filters Go-log lines relayed from older spored unless --verbose. - Gates for each path, each watched failing against a compiling revert.
…erbose By default spored's log lines (which carry the account ID) now stay off both streams; with --verbose they are relayed to stderr and still never reach stdout, so #540's guarantee holds where it applies.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Root cause
Two separate streams shared the terminal with the human output:
launchsingle/array/MPI,cancel,extend,capacity-block) usedaudit.NewLogger(os.Stderr, ...). Each security-sensitive step wrote a JSON record, with the AWS account ID asuser_id, between the progress lines.logdiagnostics. Nothing in the spawn CLI redirected the standard logger, solog.Printfcalls in library code (for examplepkg/awspricing:pricing: m8a.4xlarge in us-west-2 = ...) went to stderr with timestamps.spored statusbuilds a query agent that logs its initialization (Agent initialized ... (account: ...)) and runs an idle check (Not idle: CPU usage could not be measured ...).spawn statusthen passed spored's stderr straight through.Fix
newAuditLoggerincmd/logsink.goappends records to~/.spawn/audit.log(mode 0600, opened on first write).--verbosealso copies them to stderr. If the file can't be opened, records go to stderr exactly once instead of being dropped.cobra.OnInitialize(configureDiagnosticLog)sends the standard logger to~/.spawn/spawn.log, and--verbosealso copies it to stderr. I used OnInitialize rather than root's PersistentPreRunE becausespawn app ...has its own PersistentPreRunE and would skip root's.log.Printfand would otherwise have been hidden: no on-demand price / cost limit can't be enforced, unverified plugin source /--insecure, untagged reaper bucket, DCV QUIC rule, snapshot tag propagation, cost pricer config. These now print to stderr directly.spawn burst's progress lines do too.spored status: agent log lines are discarded by default. A new--verboseflag sends them to stderr.spawn status:relaySporedStderrdrops Go-log-timestamped lines coming from older sporeds unless--verboseis set. Any other spored stderr, such as errors, is always passed through.-o jsonstdout is unchanged and stays pure JSON. No public-surface change:pkg/awsgained no exported symbols and lost none.Tests
cmd/logsink_test.go:audit.logholds complete records with the account ID.--verbosecopies records to stderr.rootCmdchecks that the OnInitialize wiring keepslog.Printfoff stderr.cmdfile callsaudit.NewLoggerdirectly.relaySporedStderrandemitStatusare checked against the exact lines from the issue.cmd/spored/status_logs_test.goruns the realspored statuscobra command, with the agent work behind a seam, in table, JSON and--verbosemodes.TestStatusJSONStdoutIsPureJSON(spawn status -o jsonignores -o json entirely: prints the human table plus spored log lines on stdout (0.100.4) #540) now uses verbose mode for its "diagnostics are not silently dropped" assertion. That is the only mode in which they are still relayed.audit.NewLoggercall site, spored sink always stderr, duplicate fallback, eager file open, diagnostic sink straight to stderr.make checkpasses exceptTestGenerateWrapper_ChownFixesCrossUIDStickyUnlink_Docker. It needs a Docker daemon and fails the same way on unmodified main. Nested modules are clean,docs-genhas been regenerated, and the CHANGELOG has an entry under [Unreleased].Caveats
spawn status --verbosestill shows its diagnostics. With a new spored they are no longer emitted duringstatus, sospawn status --verboseshows nothing extra; runspored status --verboseon the instance to see them. spawn doesn't forward--verbose, because an older spored would reject the unknown flag.SPAWN_LOGdoesn't exist and I didn't add it;--verbosewas already the global flag.Fixes #895