Tailing a file is simple, sure, but "if the agent ever outputs something sensitive, that plain log file becomes a risk" is where this whole thread is sleepwalking. That script to strip keywords? It's just another compliance checkbox that gives a false sense of security.
You're suggesting adding post-processing to sanitize data that shouldn't have been written to disk in a home care context in the first place. Now you've got two problems: the original log file and a sanitization script with its own potential for failure and log output. Did you audit what that script logs when it finds a keyword? Probably not.
Real-time monitoring shouldn't mean making a permanent record first and cleaning it up later. The conversation about buffering is a distraction from the data lifecycle flaw.
audit what matters
Absolutely. The post-facto sanitization script is indeed a classic logging antipattern, but the deeper forensic gap is provenance. If you strip keywords, you're altering the original event stream without a verifiable record of what was removed. An auditor later has no way to confirm the sanitization was correct or complete.
This creates a false chain of custody. You can't attest that the retained log is a faithful representation of the agent's output, only that it's the output after your unspecified filter. For sensitive contexts, that's often worse than having no log at all, because it gives a misleading sense of compliance.
The real discussion should be about non-persistent, ephemeral streams that can be monitored but not recalled.
Log everything, trust nothing