AutomationFlowsMarketing & Ads › Airtable Log Cleanup 30-Day Retention

Airtable Log Cleanup 30-Day Retention

Original n8n title: Log Cleanup - 30 Day Retention

Log Cleanup - 30 Day Retention. Uses airtable. Scheduled trigger; 7 nodes.

Cron / scheduled trigger★★★★☆ complexity7 nodesAirtable
Marketing & Ads Trigger: Cron / scheduled Nodes: 7 Complexity: ★★★★☆ Added:

The workflow JSON

Copy or download the full n8n JSON below. Paste it into a new n8n workflow, add your credentials, activate. Full import guide →

Download .json
{
  "name": "Log Cleanup - 30 Day Retention",
  "nodes": [
    {
      "id": "schedule-trigger",
      "name": "Schedule Trigger",
      "type": "n8n-nodes-base.scheduleTrigger",
      "typeVersion": 1.2,
      "position": [
        250,
        300
      ],
      "parameters": {
        "rule": {
          "interval": [
            {
              "field": "cronExpression",
              "expression": "0 2 * * *"
            }
          ]
        }
      },
      "notes": "Runs daily at 02:00. Configure timezone to Asia/Kolkata in n8n settings."
    },
    {
      "id": "calculate-cutoff-date",
      "name": "Calculate Cutoff Date",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        450,
        300
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "cutoff_date",
              "name": "cutoff_date",
              "value": "={{ $now.minus({days: 30}).toISO() }}",
              "type": "string"
            },
            {
              "id": "cutoff_formula",
              "name": "cutoff_formula",
              "value": "={{ \"IF(IS_BEFORE({timestamp}, '\" + $now.minus({days: 30}).toFormat(\"yyyy-MM-dd\") + \"'), TRUE())\" }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    },
    {
      "id": "search-old-records",
      "name": "Search Old Records",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        650,
        300
      ],
      "parameters": {
        "operation": "search",
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $env.AIRTABLE_BASE_ID }}"
        },
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "AI_Logs"
        },
        "filterByFormula": "={{ $json.cutoff_formula }}",
        "returnAll": true,
        "options": {
          "fields": [
            "log_id"
          ]
        }
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "loop-over-items",
      "name": "Loop Over Items",
      "type": "n8n-nodes-base.splitInBatches",
      "typeVersion": 3,
      "position": [
        850,
        300
      ],
      "parameters": {
        "batchSize": 10,
        "options": {}
      }
    },
    {
      "id": "delete-records",
      "name": "Delete Records",
      "type": "n8n-nodes-base.airtable",
      "typeVersion": 2.1,
      "position": [
        1050,
        300
      ],
      "parameters": {
        "operation": "delete",
        "base": {
          "__rl": true,
          "mode": "id",
          "value": "={{ $env.AIRTABLE_BASE_ID }}"
        },
        "table": {
          "__rl": true,
          "mode": "name",
          "value": "AI_Logs"
        },
        "id": "={{ $json.id }}"
      },
      "credentials": {
        "airtableTokenApi": {
          "name": "<your credential>"
        }
      }
    },
    {
      "id": "wait-rate-limit",
      "name": "Wait",
      "type": "n8n-nodes-base.wait",
      "typeVersion": 1.1,
      "position": [
        1050,
        450
      ],
      "parameters": {
        "amount": 250,
        "unit": "milliseconds"
      },
      "notes": "250ms delay between batches to stay under Airtable 5 req/sec rate limit"
    },
    {
      "id": "log-cleanup-summary",
      "name": "Log Cleanup Summary",
      "type": "n8n-nodes-base.set",
      "typeVersion": 3.4,
      "position": [
        1250,
        300
      ],
      "parameters": {
        "mode": "manual",
        "duplicateItem": false,
        "assignments": {
          "assignments": [
            {
              "id": "cleanup_result",
              "name": "cleanup_result",
              "value": "Log cleanup completed",
              "type": "string"
            },
            {
              "id": "cleanup_date",
              "name": "cleanup_date",
              "value": "={{ $now.toISO() }}",
              "type": "string"
            },
            {
              "id": "records_processed",
              "name": "records_processed",
              "value": "={{ $items().length }}",
              "type": "string"
            }
          ]
        },
        "options": {}
      }
    }
  ],
  "connections": {
    "Schedule Trigger": {
      "main": [
        [
          {
            "node": "Calculate Cutoff Date",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Calculate Cutoff Date": {
      "main": [
        [
          {
            "node": "Search Old Records",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Search Old Records": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Loop Over Items": {
      "main": [
        [
          {
            "node": "Delete Records",
            "type": "main",
            "index": 0
          }
        ],
        [
          {
            "node": "Log Cleanup Summary",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Delete Records": {
      "main": [
        [
          {
            "node": "Wait",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "Wait": {
      "main": [
        [
          {
            "node": "Loop Over Items",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  },
  "active": true,
  "settings": {
    "executionOrder": "v1",
    "errorWorkflow": "CONFIGURE_ERROR_HANDLER_WORKFLOW_ID"
  },
  "tags": [
    {
      "name": "system"
    },
    {
      "name": "phase-1"
    },
    {
      "name": "scheduled"
    }
  ]
}

Credentials you'll need

Each integration node will prompt for credentials when you import. We strip credential IDs before publishing — you'll add your own.

Pro

For the full experience including quality scoring and batch install features for each workflow upgrade to Pro

About this workflow

Log Cleanup - 30 Day Retention. Uses airtable. Scheduled trigger; 7 nodes.

Source: https://github.com/ThinkyMiner/Instll-Labs-leadFollowUp/blob/c006c3ee7b976279c9a2ba4d7ead26f86a36f1d2/workflows/log-cleanup.json — original creator credit. Request a take-down →

More Marketing & Ads workflows → · Browse all categories →

Related workflows

Workflows that share integrations, category, or trigger type with this one. All free to copy and import.

Marketing & Ads

Content Analyzer (Tiktok). Uses stickyNote, scheduleTrigger, sort, airtable. Scheduled trigger; 27 nodes.

Airtable, HTTP Request, Google Drive
Marketing & Ads

Viral TikToks. Uses httpRequest, airtable, scheduleTrigger, splitInBatches. Scheduled trigger; 25 nodes.

HTTP Request, Airtable
Marketing & Ads

Use Case: automates marketing ROI tracking by linking closed deals to their lead sources in Airtable, calculating revenue and ROI per channel, and sending daily insights to Slack. Runs nightly to anal

Airtable, Slack, Gmail
Marketing & Ads

GoBot - Scheduled Content Posting. Uses scheduleTrigger, airtable, splitInBatches, httpRequest. Scheduled trigger; 6 nodes.

Airtable, HTTP Request
Marketing & Ads

Loop 3 — Lead Scoring. Uses airtable. Scheduled trigger; 5 nodes.

Airtable