Automated Server Log Cleanup via Email Alerts & SSH (Nginx/Docker)

Monitors IMAP emails for disk usage alerts >80%, extracts server IP, SSH connects, and purges Nginx, PM2, Docker, and system logs to reclaim space automatically.

n8n
Automated Server Log Cleanup via Email Alerts & SSH (Nginx/Docker)

This n8n workflow automates server maintenance by watching for email alerts on high disk utilization (over 80%). Upon receiving an alert, it parses the email content to extract the affected server's IP address, prepares SSH credentials and log paths, then securely logs in via SSH to execute targeted cleanup commands. Logs from Nginx access/error files, PM2 processes, Docker containers, and standard system directories (like /var/log) are safely rotated or deleted, preventing disk outages without manual intervention.

Key benefits include proactive disk space management, reducing downtime risks for production servers, and saving hours of manual sysadmin work. It's ideal for teams managing multiple VPS, cloud instances, or Dockerized apps where log bloat is common. The workflow handles unseen emails with 'disk' in the subject, ensuring reliable triggering.

Use cases span DevOps, hosting providers, and web agencies running Nginx/PM2 stacks. Customize by adjusting log paths in the 'Prepare SSH Variables' node or adding retention policies. Prerequisites: IMAP email access for alerts and SSH keys/passwords configured in n8n. Test with mock emails to validate IP extraction and cleanup before production.

$16.99
Last updated November 14, 2026
30-day money-back guarantee
Instant download
Lifetime updates included

New buyers can create an account from the cart to unlock a controlled $10 first-purchase credit on eligible orders of $25+.

Secure checkout powered by Stripe

Support

How to import this workflow into n8n

  1. 1Purchase or download the workflow to get the n8n workflow JSON file.
  2. 2In your n8n instance, open Workflows and choose "Import from File" (or paste the JSON with Ctrl+V on the canvas).
  3. 3Open each node marked with a credential warning and connect your own accounts and API keys.
  4. 4Run the workflow once manually to verify the data flow, then toggle it to Active.

Related Finance & Accounting workflows

More from Arjun Radu

Need this deployed? We'll set it up for you.

Our automation experts deploy this workflow in your stack, connect your accounts, and verify it works — or build a custom solution from scratch.