Log Errors and Avoid Sending Too Many Emails (Error Logging and Email Frequency Control)

This workflow is designed to automatically capture and record system errors while controlling the frequency of error notifications through database statistics to avoid excessive email alerts. It saves error information to a Postgres database and supports flexible integration into existing processes. Additionally, the workflow provides an automatic cleanup feature for error logs, ensuring a tidy development environment. It is suitable for automated systems that require centralized management of errors and monitoring notifications, enhancing the efficiency and responsiveness of error handling.

Tags

error logalert throttling

Workflow Name

Log Errors and Avoid Sending Too Many Emails (Error Logging and Email Frequency Control)

Key Features and Highlights

This workflow is designed to capture and log error events within a system while controlling the frequency of error notification emails through database statistics, preventing alert flooding caused by excessive errors. It supports saving detailed error information into a Postgres database and can be configured either as the primary error handler or integrated as a sub-workflow within existing error handling processes. Additionally, it offers automatic error log cleanup functionality to facilitate maintenance in development environments.

Core Problems Addressed

  • Automatically records all errors to ensure complete preservation of error information for subsequent troubleshooting.
  • Limits the frequency of error notification emails to prevent excessive alerts during error surges.
  • Supports flexible integration to adapt to various error handling strategies.
  • Provides an error log cleanup mechanism for development environments to maintain database hygiene.

Use Cases

  • Any automated process requiring centralized management and monitoring of system errors.
  • Business systems that need to avoid excessive alerts triggered by frequent errors within a short period.
  • Development and testing environments that require periodic error log cleanup.
  • As part of a large-scale automation system’s error handling chain to unify error log recording.

Main Workflow Steps

  1. Error Trigger: Capture error events occurring during workflow execution.
  2. Insert Log: Write error details—including error message, stack trace, triggering node, and calling URL—into a specified table in the Postgres database.
  3. Count for 5 Minutes: Query the number of errors recorded in the past 5 minutes.
  4. If There Are No Logs in 5 Minutes: Determine whether any errors have been logged in the last 5 minutes to decide if notifications should be sent.
  5. Insert Your Error Handling Logic After This: Reserved insertion point for user-defined error handling logic.
  6. CleanUp Execution: Clear execution status to ensure the workflow terminates properly.
  7. Sometimes... Just Cleanup + Truncate Log Database: Manual trigger to perform error log database cleanup operations.

In addition, the workflow includes optional email notification nodes (Principal E-Mail, Fallback E-Mail) and mobile push notification nodes (Push Mobile Notification), which can be enabled as needed to provide multi-channel error alerts.

Systems or Services Involved

  • Postgres Database (operated via Postgres nodes for error log recording and querying)
  • SMTP Email Service (email sending nodes for error notifications; nodes are disabled by default)
  • Pushover Push Service (mobile push notifications; nodes are disabled by default)

Target Users and Value

  • DevOps engineers and automation operations teams seeking efficient and controllable error monitoring and alerting within automated workflows.
  • Developers managing error logs during development and testing phases to avoid alert flooding and maintain a clean environment.
  • Enterprise IT managers aiming to reduce false alarms and improve response efficiency through centralized logging and intelligent alerting.
  • Any users of automated systems requiring stable error recording while preventing excessive email disturbances.

This workflow was designed by Davi Saranszky Mesquita. It comes with detailed documentation and example DDL scripts to facilitate quick deployment and customization according to user needs. By properly configuring the Postgres tables and email/push notification services, users can achieve efficient error management and alert throttling.

Recommend Templates

GitLab Code Change Automated Review and Comment Generation Workflow

This workflow listens for comment events on GitLab merge requests through a Webhook, automatically retrieves code changes, and analyzes the differences. It uses an intelligent language model to review and score each change, generating professional review suggestions, which are then posted back to GitLab as comments, creating a fully automated code review process. This process significantly enhances the efficiency and quality of code reviews, reduces the risk of human oversight, and is suitable for CI/CD processes in software development teams and the maintenance of open-source projects.

Code ReviewAutomation Workflow

Create, Update, and Retrieve an Issue on Taiga

This workflow is designed to automate the management of tasks (Issues) on the Taiga project management platform, including the creation, updating, and retrieval of task information. Users can complete the entire process of task management with a single manual trigger, significantly improving project management efficiency and reducing the complexity and errors associated with manual operations. It is particularly suitable for software development teams, product managers, and other users who need to quickly synchronize and manage task information, ensuring timely updates and accuracy of data.

Taiga AutomationTask Management

PagerDuty and Jira Incident Closure with Mattermost Notification Automation Workflow

This workflow automates the incident management process, ensuring that incidents marked as resolved in PagerDuty can automatically update the corresponding Jira task status to "Closed" in real-time. Additionally, incident resolution information is instantly pushed to a designated Mattermost channel, helping team members stay informed about the progress of the resolution. This automated process reduces errors caused by manual operations, enhances collaboration efficiency, and addresses the issue of information silos across systems, making it suitable for operations, DevOps, and IT support teams.

Event AutomationSystem Integration

Command Execution and Conditional Judgment Workflow

This workflow enables the automatic execution of system commands and data processing. It parses the JSON data output from the command line, performing conditional judgments and logical branching control. It is suitable for automated monitoring and script result processing, allowing for flexible integration of command line tool outputs. This is ideal for IT operations and DevOps personnel, enhancing the efficiency of automated processing, reducing human intervention, and enabling dynamic decision-making in complex business scenarios.

Command ExecutionCondition Check

airflow dag_run

This workflow automatically triggers and monitors the execution of specified DAGs by calling the REST API of Apache Airflow, allowing real-time retrieval of task execution results. It has built-in status checks and timeout mechanisms to intelligently handle different states, ensuring the stability and controllability of the workflow. It is suitable for scenarios that require remote triggering and monitoring of data pipeline tasks, improving work efficiency, reducing human intervention, and ensuring the smooth progress of task processes.

Airflow Auto TriggerStatus Monitoring

puq-docker-n8n-deploy

This workflow provides a complete set of API backend solutions specifically designed for managing and controlling Docker-based container instances, catering to the integration needs of WHMCS/WISECP modules. Its functionalities include operations such as deploying, starting, stopping containers, mounting disks, managing permissions, and viewing logs. It supports receiving commands through a Webhook API and implements dynamic configuration and access control. Additionally, it integrates an error handling mechanism to ensure efficient and secure operations, providing convenient automated management tools for cloud service providers and IT operations teams.

n8n automationDocker management

Automate Assigning GitHub Issues

This workflow is designed to automate the handling of issues and comments in GitHub repositories. It intelligently determines whether a responsible person needs to be assigned and automatically assigns unassigned issues to appropriate users. It can recognize requests from users who proactively claim tasks, avoiding duplicate assignments and significantly enhancing project management efficiency. Whether in open-source projects or internal enterprise development, this workflow helps accelerate response times, reduce the burden on maintainers, and achieve more efficient team collaboration.

GitHub Auto AssignTask Management

n8n Workflow Deployer

This workflow implements automated deployment functionality by monitoring a specific folder in Google Drive, automatically downloading and processing JSON files of n8n workflows. After formatting and cleaning, it uses an API to import the workflows into a designated instance and automatically sets tags. Finally, the deployed files are archived into another folder. The entire process requires no manual intervention, significantly enhancing the efficiency of workflow management and deployment, making it suitable for teams that need to manage and update workflows in bulk.

n8n auto deployGoogle Drive integration