<@ULVA73B9P> If I've set up Prefect to log as JSON...
# marvin-in-the-wild
i
@Marvin If I've set up Prefect to log as JSON, and a flow calls a subprocess that also logs as JSON, is it possible to have the captured subprocess logs be structured (i.e. not an escaped JSON string)?
m
The search results did not yield direct information specific to your query about capturing structured JSON logs from subprocesses in Prefect flows. However, based on my experience, here’s what you can consider: 1. Prefect Shell Integration: Use Prefect's
ShellOperation
or similar to run your subprocess. Ensure that the subprocess logs in JSON format are being captured correctly by the Shell tasks. - Prefect Shell Integration Documentation 2. Log Handling: If the subprocess logs in JSON strings, you might need to parse these logs in Prefect. You can implement a custom log handler or transformer within your Prefect flow to process these JSON strings and store them as structured logs. 3. Audit Logs and JSON Handling: Review the audit log capabilities and how Prefect handles logs in JSON format. This can give you insights into structuring your log management system. - Audit Log Documentation Although the searched GitHub issues didn’t provide relevant results, you may open a new discussion or issue if this feature is vital to your workflow. Would you need help with implementing a custom log handler or examples on structured logging in Prefect?