Overview
This node logs messages to Datadog based on a user-defined condition. It evaluates a specified condition for each input item and sends a log message to Datadog with a corresponding log level depending on whether the condition is met or not. This is useful for monitoring workflows by sending custom logs to Datadog, enabling alerting, visualization, and troubleshooting.
Common scenarios:
- Logging success or failure states of workflow executions.
- Sending custom event logs to Datadog for audit trails.
- Tagging logs with service names and environment tags for better filtering in Datadog.
Example:
If a workflow step completes successfully (condition true), log an INFO message "Step completed" with service name "my-service". If it fails (condition false), log an ERROR message "Step failed" with the same service name.
Properties
| Name | Meaning |
|---|---|
| Datadog Site | The Datadog site to send logs to. Options: datadoghq.com, datadoghq.eu. |
| Condition | A filter expression evaluated per item to decide which log message and level to use. |
| Success | Collection containing: - Message: Log message if condition is true. - Log Level: One of DEBUG, INFO, WARN, ERROR. |
| Failure | Collection containing: - Message: Log message if condition is false. - Log Level: One of DEBUG, INFO, WARN, ERROR. |
| Tags | Comma-separated tags added to the log message (e.g., env:test,service:my-service). |
| Service Name | The service name associated with the log message; required for proper identification in Datadog. |
Output
The node outputs the original input items that were processed and logged to Datadog as JSON. Each output item corresponds to an input item for which the log was sent (either condition met or, if configured, on failure with continue-on-fail).
No binary data is produced.
Dependencies
- Requires an API key credential for authenticating requests to Datadog's Logs API.
- Needs network access to
https://http-intake.logs.{site}/api/v2/logswhere{site}is selected from the Datadog Site property. - The node uses the n8n helper method to perform authenticated HTTP POST requests.
Troubleshooting
Common issues:
- Incorrect or missing API authentication token will cause request failures.
- Invalid condition expressions may cause evaluation errors or unexpected logging behavior.
- Network connectivity issues to Datadog endpoints can prevent logs from being sent.
- Missing required properties like Service Name may result in incomplete log entries.
Error messages:
- Authentication errors from Datadog API indicate invalid or missing credentials.
- HTTP request failures may show status codes like 400 or 403; verify endpoint URL and permissions.
- Condition evaluation errors should be checked by validating the filter syntax used in the Condition property.
Resolutions:
- Ensure the API key credential is correctly configured and has permissions to send logs.
- Validate the condition expression syntax before running the workflow.
- Confirm network access to the selected Datadog site.
- Provide a non-empty Service Name to properly tag logs.