Skip to main content

Workflow Audit

Workflow Audit provides execution history tracking for workflows, allowing you to monitor workflow runs, view execution logs, and troubleshoot failed executions.

Enabling Audit

To enable audit logging for a workflow, set enableAudit: true in the workflow definition:

workflow:
workflowId: "2e28201d-704e-40b1-8568-7a87d198e255"
name: "Send Order Confirmation Email"
enableAudit: true # Enable audit logging
logLevel: "Debug" # Optional: Set log level for detailed logs

Workflow Attributes for Audit

AttributeTypeDefaultDescription
enableAuditbooleanfalseEnable audit logging for the workflow
logLevelstringNoneLogging level: None, Debug, Info, Warning, Error

Storage Architecture

Workflow execution data is stored in two locations:

1. Database (PostgreSQL)

Execution metadata is stored in the WorkflowExecutionLogs table for fast queries:

FieldTypeDescription
ExecutionIdUUIDUnique identifier for the execution
WorkflowIdUUIDReference to the workflow
OrganizationIdintOrganization that owns the workflow
UserIdstringUser who triggered the execution
ExecutedAtDateTimeWhen the execution started
ExecutionStatusenumSuccess or Failed
DurationMslongExecution duration in milliseconds

2. S3 Storage

Detailed execution logs are stored in S3:

logs/workflows/orgs/{organizationId}/{workflowId}/{timestamp}-{executionId}-{userId}{-failed}.txt
logs/workflows/orgs/{organizationId}/{workflowId}/{timestamp}-{executionId}-{userId}{-failed}.json

File Types:

ExtensionContent
.txtRaw execution logs (Serilog output)
.jsonStructured metadata (inputs, outputs, exceptions, timing)

Accessing Execution History

GraphQL API

Get Single Execution

query {
workflowExecution(organizationId: 1, executionId: "guid-here") {
executionId
workflowId
executedAt
executionStatus
durationMs
txtLogUrl # Pre-signed URL for .txt log file
jsonLogUrl # Pre-signed URL for .json log file
user {
fullName
email
}
}
}

List Executions with Pagination

query {
workflowExecutions(
organizationId: 1
workflowId: "guid-here"
filter: "executionStatus:Failed" # Optional: Filter by status
orderBy: "-executedAt" # Optional: Sort order (default: most recent first)
) {
items {
executionId
executedAt
executionStatus
durationMs
txtLogUrl
jsonLogUrl
user {
fullName
}
}
pageInfo {
hasNextPage
hasPreviousPage
}
}
}

Filter Examples

FilterDescription
executionStatus:FailedShow only failed executions
executionStatus:SuccessShow only successful executions
userId:[email protected]Filter by user

Sort Options

Order ByDescription
-executedAtMost recent first (default)
executedAtOldest first
-durationMsLongest duration first
durationMsShortest duration first

Pre-signed URLs

Log file URLs are generated on-demand as pre-signed S3 URLs with time-limited access. These URLs are only generated when you request the txtLogUrl or jsonLogUrl fields in your GraphQL query.

Security Features:

  • URLs expire after a configured time period
  • Each URL is unique per request
  • Access is controlled by organization permissions

JSON Log Structure

The .json log file contains structured execution data:

{
"executionId": "guid",
"organizationId": 1,
"workflowId": "guid",
"workflowName": "Send Order Confirmation Email",
"inputs": {
"orderId": 12345,
"emailAddress": "[email protected]"
},
"outputs": {
"response": "Email sent successfully",
"statusCode": 200
},
"exception": null,
"isSuccess": true,
"startExecutionTime": "2025-01-18T10:00:00Z",
"endExecutionTime": "2025-01-18T10:00:05Z",
"userId": "[email protected]"
}

Disabling Audit Logging

Per-Workflow

Set enableAudit: false in the workflow definition:

workflow:
name: "High-Volume Workflow"
enableAudit: false # Disable audit for this workflow

Environment-Wide

Set the environment variable to disable all audit logging:

DISABLE_AUDIT_LOGGING=true

This is useful for local development or testing environments.

Best Practices

  1. Enable audit for critical workflows - Always enable audit for workflows that process important business data.

  2. Use appropriate log levels - Use Debug for development/troubleshooting, Info or Warning for production.

  3. Monitor failed executions - Regularly review failed executions using the executionStatus:Failed filter.

  4. Clean up old logs - Implement S3 lifecycle policies to archive or delete old execution logs.

  5. Protect sensitive data - Be aware that inputs and outputs are logged. Avoid logging sensitive data like passwords or API keys.

Example: Complete Workflow with Audit

workflow:
workflowId: "2e28201d-704e-40b1-8568-7a87d198e255"
name: "Process Order"
description: "Process incoming orders"
isActive: true
enableAudit: true
logLevel: "Info"
executionMode: "Async"

triggers:
- type: "Entity"
entityName: "Order"
eventType: "Added"
position: "After"

inputs:
- name: "orderId"
type: "Order"

outputs:
- name: "result"
mapping: "processOrder.result"

activities:
- name: "processOrder"
steps:
- task: "Order/Process@1"
name: "process"
inputs:
orderId: "{{ orderId }}"
outputs:
- name: "result"

With audit enabled, each execution of this workflow will:

  1. Create a record in the WorkflowExecutionLogs database table
  2. Upload detailed logs to S3 (.txt and .json files)
  3. Be queryable via GraphQL API