8
n8n 한국어amn8n.com

이메일 알림을 통한 자동화 디스크 정리 - 서버 로그 정리 워크플로

중급

이것은DevOps분야의자동화 워크플로우로, 8개의 노드를 포함합니다.주로 Set, Ssh, Code, EmailReadImap 등의 노드를 사용하며. SSH 및 이메일 알림을 통한 Nginx, Docker 및 시스템 로그 자동화 정리

사전 요구사항
  • 특별한 사전 요구사항 없이 가져와 바로 사용 가능합니다

카테고리

워크플로우 미리보기
노드 연결 관계를 시각적으로 표시하며, 확대/축소 및 이동을 지원합니다
워크플로우 내보내기
다음 JSON 구성을 복사하여 n8n에 가져오면 이 워크플로우를 사용할 수 있습니다
{
  "id": "4Y5VQwUUo7uqPPL1",
  "meta": {
    "instanceId": "dd69efaf8212c74ad206700d104739d3329588a6f3f8381a46a481f34c9cc281",
    "templateCredsSetupCompleted": true
  },
  "name": "Auto Disk Cleanup via Email Alert – Server Log Purge Workflow",
  "tags": [],
  "nodes": [
    {
      "id": "8c1aac94-9e6a-4b14-a177-3a00644ea232",
      "name": "디스크 경고 이메일 확인",
      "type": "n8n-nodes-base.emailReadImap",
      "position": [
        0,
        0
      ],
      "parameters": {
        "options": {
          "customEmailConfig": "[\"UNSEEN\", [\"SUBJECT\", \"disk\"]]"
        }
      },
      "credentials": {
        "imap": {
          "id": "D3nLrSlP1dHWcIDE",
          "name": "IMAP account"
        }
      },
      "typeVersion": 2
    },
    {
      "id": "025c2c15-f693-4b53-8433-4d641526d11a",
      "name": "이메일에서 서버 IP 추출",
      "type": "n8n-nodes-base.code",
      "position": [
        220,
        0
      ],
      "parameters": {
        "jsCode": "const subject = $input.first().json.subject;\n\nif (subject && (subject.toLowerCase().includes(\"disk-utilization\") || subject.toLowerCase().includes(\"disk utilization\"))) {\n  const ipMatch = subject.match(/(\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}\\.\\d{1,3}):9100/);\n  const server_ip = ipMatch ? ipMatch[1] : '';\n  return [{ json: { server_ip } }];\n} else {\n  // Stop workflow if subject doesn't match\n  return [];\n}"
      },
      "typeVersion": 2
    },
    {
      "id": "723c7067-fe88-4b8b-b1ff-38c9eb662641",
      "name": "SSH 변수 준비",
      "type": "n8n-nodes-base.set",
      "position": [
        440,
        0
      ],
      "parameters": {
        "options": {},
        "assignments": {
          "assignments": [
            {
              "id": "49c16fb1-4b84-46a7-bb50-5e1fa7f59664",
              "name": "pwd",
              "type": "string",
              "value": "password"
            },
            {
              "id": "c16557bd-7ef6-4049-a634-a5b207a92fd6",
              "name": "server_user",
              "type": "string",
              "value": "user"
            },
            {
              "id": "fd8c4253-8ab2-4094-9a72-78ef782d89d3",
              "name": "server_ip",
              "type": "string",
              "value": "={{ $input.first().json.server_ip }}"
            }
          ]
        }
      },
      "typeVersion": 3.4
    },
    {
      "id": "7ef2b2b6-5880-4fc1-93fa-b76c3c75effa",
      "name": "SSH를 통한 로그 정리 명령어 실행",
      "type": "n8n-nodes-base.ssh",
      "position": [
        660,
        0
      ],
      "parameters": {
        "command": "=echo '{{ $json.pwd }}' | sudo -S su - jenkins -c \"ssh {{ $json.server_user }}@{{ $json.server_ip }} 'sudo rm -rf /var/log/*.gz && sudo rm -rf /var/log/*.1 && sudo rm -rf /var/log/nginx/*.log && sudo rm -rf /var/log/apache2/*.log && sudo journalctl --vacuum-size=200M && sudo apt-get clean && sudo apt-get autoclean && docker builder prune -af && docker system df && sudo apt-get autoremove -y'\""
      },
      "credentials": {
        "sshPassword": {
          "id": "e5pmM8y0fJOZytlE",
          "name": "Jenkins Server SSH"
        }
      },
      "typeVersion": 1
    },
    {
      "id": "0935c618-237c-4630-9087-80b757a78a9c",
      "name": "스티키 노트",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        -20,
        -140
      ],
      "parameters": {
        "width": 160,
        "height": 300,
        "content": "Triggers when an alert email about disk usage is received.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "d4efc5ab-9003-4d42-a49c-6ac4c376c9cb",
      "name": "스티키 노트1",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        180,
        -140
      ],
      "parameters": {
        "color": 3,
        "width": 170,
        "height": 300,
        "content": "Parses the email body to extract the target server's IP address.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "adf3341f-4319-40cc-bf97-8917a2bb5c44",
      "name": "스티키 노트2",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        400,
        -140
      ],
      "parameters": {
        "color": 4,
        "width": 170,
        "height": 300,
        "content": "Manually set or map credentials, paths, or other config values.\n"
      },
      "typeVersion": 1
    },
    {
      "id": "4c933879-5907-4616-8902-42cfb2d73edc",
      "name": "스티키 노트3",
      "type": "n8n-nodes-base.stickyNote",
      "position": [
        620,
        -140
      ],
      "parameters": {
        "color": 6,
        "width": 170,
        "height": 300,
        "content": "Executes cleanup commands (Nginx, PM2, Docker, system logs).\n\n"
      },
      "typeVersion": 1
    }
  ],
  "active": false,
  "pinData": {},
  "settings": {
    "executionOrder": "v1"
  },
  "versionId": "fbb7d480-4bbd-4240-9e95-459b563adba4",
  "connections": {
    "723c7067-fe88-4b8b-b1ff-38c9eb662641": {
      "main": [
        [
          {
            "node": "7ef2b2b6-5880-4fc1-93fa-b76c3c75effa",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "8c1aac94-9e6a-4b14-a177-3a00644ea232": {
      "main": [
        [
          {
            "node": "025c2c15-f693-4b53-8433-4d641526d11a",
            "type": "main",
            "index": 0
          }
        ]
      ]
    },
    "025c2c15-f693-4b53-8433-4d641526d11a": {
      "main": [
        [
          {
            "node": "723c7067-fe88-4b8b-b1ff-38c9eb662641",
            "type": "main",
            "index": 0
          }
        ]
      ]
    }
  }
}
자주 묻는 질문

이 워크플로우를 어떻게 사용하나요?

위의 JSON 구성 코드를 복사하여 n8n 인스턴스에서 새 워크플로우를 생성하고 "JSON에서 가져오기"를 선택한 후, 구성을 붙여넣고 필요에 따라 인증 설정을 수정하세요.

이 워크플로우는 어떤 시나리오에 적합한가요?

중급 - 데브옵스

유료인가요?

이 워크플로우는 완전히 무료이며 직접 가져와 사용할 수 있습니다. 다만, 워크플로우에서 사용하는 타사 서비스(예: OpenAI API)는 사용자 직접 비용을 지불해야 할 수 있습니다.

워크플로우 정보
난이도
중급
노드 수8
카테고리1
노드 유형5
난이도 설명

일정 경험을 가진 사용자를 위한 6-15개 노드의 중간 복잡도 워크플로우

저자
Oneclick AI Squad

Oneclick AI Squad

@oneclick-ai

The AI Squad Initiative is a pioneering effort to build, automate and scale AI-powered workflows using n8n.io. Our mission is to help individuals and businesses integrate AI agents seamlessly into their daily operations from automating tasks and enhancing productivity to creating innovative, intelligent solutions. We design modular, reusable AI workflow templates that empower creators, developers and teams to supercharge their automation with minimal effort and maximum impact.

외부 링크
n8n.io에서 보기

이 워크플로우 공유

카테고리

카테고리: 34