Add application-logs module with driver pattern for logic function log persistence (#19486)
## Summary
- Introduces a new `application-logs` core module with a driver pattern
(disabled/console/clickhouse) to capture and persist logic function
execution logs
- Adds a ClickHouse `applicationLog` table with per-line log storage,
30-day TTL, and `ORDER BY (workspaceId, timestamp, applicationId,
logicFunctionId)`
- Surfaces application logs in the existing frontend audit logs table as
a new "Application Logs" source with dedicated columns (Function,
Timestamp, Level, Message, Execution ID)
## Details
**Write path**: `LogicFunctionExecutorService.handleExecutionResult()`
parses the multi-line log string from driver output into individual `{
timestamp, level, message }` entries, generates an execution UUID, and
passes them to `ApplicationLogsService.writeLogs()` which delegates to
the configured driver.
**Driver pattern**: Follows the exception-handler module style (Symbol
injection token + `forRootAsync` dynamic module). Three drivers:
- `DISABLED` (default) — no-op, prevents information leaking
- `CONSOLE` — structured stdout logging with level-based `console.*`
calls
- `CLICKHOUSE` — inserts rows into the `applicationLog` ClickHouse table
**Read path**: Extends the existing event-logs module by adding
`APPLICATION_LOG` to the `EventLogTable` enum, table name mapping, and
normalization logic.
**Config**: New `APPLICATION_LOG_DRIVER_TYPE` environment variable
(default: `DISABLED`).
This commit is contained in:
+15
@@ -0,0 +1,15 @@
|
||||
CREATE TABLE IF NOT EXISTS applicationLog
|
||||
(
|
||||
`timestamp` DateTime64(3) NOT NULL,
|
||||
`workspaceId` String NOT NULL,
|
||||
`applicationId` String DEFAULT '',
|
||||
`logicFunctionId` String DEFAULT '',
|
||||
`logicFunctionName` String DEFAULT '',
|
||||
`executionId` String DEFAULT '',
|
||||
`level` LowCardinality(String) DEFAULT 'INFO',
|
||||
`message` String NOT NULL,
|
||||
`properties` JSON
|
||||
)
|
||||
ENGINE = MergeTree
|
||||
ORDER BY (workspaceId, timestamp, applicationId, logicFunctionId)
|
||||
TTL timestamp + INTERVAL 30 DAY DELETE;
|
||||
Reference in New Issue
Block a user