Winston Log Trigger

Trigger workflow based on Winston log events

Overview

This node acts as a trigger that activates workflows based on Winston log events. It listens for log messages generated by the Winston logging library and triggers the workflow when a log entry meets specified criteria such as minimum log level and optional source filtering.

Common scenarios where this node is beneficial include:

  • Monitoring application logs to automatically respond to errors or warnings.
  • Triggering alerts or notifications when specific log messages appear.
  • Integrating log-based events into automation workflows, e.g., restarting services or creating tickets upon critical log entries.

For example, you could configure the node to trigger whenever an error-level log is emitted from a particular module, enabling automated incident management.

Properties

Name Meaning
Log Level The minimum severity of log messages that will trigger the workflow. Options: Error, Warn, Info, Debug.
Log Format The format in which log messages are expected. Options: Simple (plain text), JSON (structured).
Log Source Optional string to filter logs by their source or category. Only logs matching this source will trigger the workflow.

Output

The node outputs data in the json field with the following structure:

  • message: The log message content (string).
  • level: The log level of the message (e.g., error, warn, info, debug).
  • source: (optional) The source/category of the log if provided.
  • timestamp: ISO 8601 timestamp string indicating when the log was processed.

If the log format is JSON, the output reflects the parsed JSON log object enriched with a timestamp. For simple format, the message is wrapped in a JSON object with the configured log level and timestamp.

No binary data output is produced by this node.

Dependencies

  • Requires the Winston logging library to be available in the environment.
  • No external API keys or credentials are needed.
  • No special n8n environment variables or configurations are required beyond standard node setup.

Troubleshooting

  • Logs not triggering the workflow: Ensure the log level set in the node matches or is lower than the log messages' levels. Also verify the optional log source filter matches the source field in your logs.
  • Malformed JSON logs: If using JSON log format, invalid JSON strings will cause parsing errors. Use the simple format if logs are plain text.
  • No output despite logs: Confirm that the Winston logger is correctly sending logs to the stream used by this node.
  • Error messages during execution: Errors related to stream writing or JSON parsing may occur; check the log format setting and input log data validity.

Links and References

Discussion