---
title: Monitor workflow execution
source: https://docs.newrelic.com/docs/workflow-automation/manage-workflows/monitor-workflow-execution
---

This article describes how to use observability data to monitor workflow run and schedule execution.

## Audits

All NerdGraph mutation calls produce audit records that you can query in `NrAuditEvent` in the customer account.

### WorkflowRun

```sql
SELECT actionIdentifier, actorId, actorType, description
FROM NrAuditEvent 
WHERE targetType = 'workflow_run'
SINCE 1 hour ago
```

### WorkflowSchedule

```sql
SELECT actionIdentifier, actorId, actorType, description
FROM NrAuditEvent 
WHERE targetType = 'workflow_schedule'
SINCE 1 hour ago
```

## Events

All workflow runs emit `WorkflowAutomationEvent` data in NRDB in the customer account that started or scheduled the workflow.

Workflow runs store event data in the `WorkflowAutomation` namespace.

### WorkflowAutomationEvent schema

The following table describes the attributes in each `WorkflowAutomationEvent` event.

| Attribute              | Type                                                   | Description                                                      |
| ---------------------- | ------------------------------------------------------ | ---------------------------------------------------------------- |
| `timestamp`            | EpochMillisecond                                       | Event timestamp                                                  |
| `type`                 | WORKFLOW \| STEP                                       | Type of event                                                    |
| `status`               | STARTED \| COMPLETED \| FAILED \| TIMED_OUT \| STOPPED | Status associated with the event                                 |
| `definitionName`       | String                                                 | Workflow definition name associated with this workflow run       |
| `definitionVersion`    | String                                                 | Workflow definition version associated with this workflow run    |
| `definitionScopeType`  | GLOBAL \| ORGANIZATION \| ACCOUNT                      | Workflow definition scope type associated with this workflow run |
| `definitionScopeId`    | String                                                 | Workflow definition scope ID associated with this workflow run   |
| `definitionEntityGuid` | String                                                 | Workflow definition entityGuid associated with this workflow run |
| `userId`               | Int                                                    | New Relic's user ID that started the workflow                    |
| `runId`                | UUID                                                   | Unique ID of the workflow run                                    |
| `durationMillisecond`  | EpochMillisecond                                       | Duration for COMPLETED, FAILED, or TIMED_OUT events              |
| `stepName`             | String                                                 | Customer-given step name in the workflow                         |
| `stepType`             | ACTION \| LOOP \| SWITCH \| STATE                      | Type of step that generated this event                           |
| `stepActionName`       | String                                                 | Fully qualified name of the action                               |
| `stepActionVersion`    | Int                                                    | Version of the action                                            |

The `stepType` attribute has the following values:

-   `ACTION`: Executes an action from the catalog
-   `LOOP`: Iterates over a collection
-   `SWITCH`: Evaluates conditions
-   `STATE`: Stores key/value pairs in the workflow's shared state

### Example query

The following query returns all events for a specific workflow run:

```sql
SELECT *
FROM WorkflowAutomationEvent
where definitionName = 'json-parsing' and runId = '31c973d2-c669-4bd7-9b15-7e3a70a4a074'
SINCE 1 month ago
```

![Diagram of WorkflowAutomationEvent schema](https://docs.newrelic.com/images/json_parsing.webp "Diagram of WorkflowAutomationEvent schema")

## Logs

Optionally, you can start or schedule a workflow with a `logLevel` verbosity option. Logs go to the account that started or scheduled the workflow.

Logs include the following attributes:

-   `workflowAutomation.name` is the WorkflowDefinition name
-   `workflowAutomation.version` is the WorkflowDefinition version
-   `workflowAutomation.runId` is the Workflow runId
-   `entityGuid` is the WorkflowDefinition id

If a schedule occurrence started the workflow, the log entries also include `workflowAutomation.scheduleId`.

For Action step type, when using `DEBUG`, each action input adds an additional attribute to the log entry with the format `workflowAutomation.inputs.<inputName>: <inputValue>`.

For Action step type, when using `TRACE`, each action output adds an additional attribute to the log entry with the format `workflowAutomation.outputs.<outputName>: <outputValue>`.

### Example NRQL query

You can query your log with the following NRQL query:

```sql
SELECT message FROM Log WHERE workflowAutomation.runId = '{run_id}' SINCE 3 hours ago
```

![Diagram of log attributes for workflow runs](https://docs.newrelic.com/images/log_attributes.webp "Diagram of log attributes for workflow runs")

Besides `workflowAutomation.runId`, some other log attributes that can help with Log data querying are:

-   `workflowAutomation.name`
-   `workflowAutomation.version`

For scheduled runs, the log entries also include the `workflowAutomation.scheduleId` attribute.
