62 lines
2.1 KiB
Markdown
62 lines
2.1 KiB
Markdown
# Nextcloud Log Alert 🚀
|
||
|
||
**Automatisierte Überwachung und Benachrichtigung von Nextcloud-Logs via Discord Webhook**
|
||
|
||
## 📌 Überblick
|
||
Dieses Projekt bietet eine einfache Möglichkeit, Nextcloud-Logeinträge automatisch zu überwachen und relevante Meldungen an einen Discord-Kanal zu senden.
|
||
Es nutzt ein Python-Skript, das über einen systemd-Service automatisch gestartet wird und alle 30 Sekunden neue Logeinträge überprüft.
|
||
|
||
## 🔧 Features
|
||
- ✅ **Automatische Erkennung neuer Logeinträge** – Nur neue Meldungen werden gesendet, um Spam zu vermeiden.
|
||
- ✅ **Einfache Einrichtung** – Ein Bash-Installationsskript erledigt die gesamte Konfiguration.
|
||
- ✅ **Persistente Konfiguration** – Der Discord Webhook wird in einer Konfigurationsdatei gespeichert.
|
||
- ✅ **Systemd-Integration** – Automatischer Start des Services beim Booten.
|
||
- ✅ **Leichtgewichtig und ressourcenschonend**
|
||
|
||
## 📥 Installation
|
||
|
||
### Webhook erstellen:
|
||
- https://support.discord.com/hc/de/articles/228383668-Einleitung-in-Webhooks
|
||
|
||
|
||
### 1️⃣ Repository klonen
|
||
```bash
|
||
git clone https://gitea.archer-sys.de/torge.eiben/NextcloudLogAlert
|
||
cd NextcloudLogAlert
|
||
sudo chmod +x setup.sh
|
||
sudo chmod +x uninstall.sh
|
||
```
|
||
### 2️⃣ Installationsskript ausführen
|
||
```bash
|
||
sudo ./install.sh
|
||
```
|
||
Das Skript erledigt:
|
||
- ✅ Erstellung des notwendigen Verzeichnisses (/opt/nextcloud_log_alert)
|
||
- ✅ Einrichtung der Konfigurationsdatei (webhook.conf)
|
||
- ✅ Aktivierung des systemd-Services
|
||
|
||
### 3️⃣ Discord Webhook hinterlegen
|
||
Während der Installation wirst du nach der Webhook-URL für Discord gefragt. Falls du sie später ändern möchtest:
|
||
|
||
```bash
|
||
sudo nano /opt/nextcloud_log_alert/webhook.conf
|
||
```
|
||
|
||
### ⚙️ Konfigurationsdateien
|
||
/opt/nextcloud_log_alert/webhook.conf – Speichert die Webhook-URL.
|
||
/home/data/nextcloud.log – Logdatei von Nextcloud, die überwacht wird.
|
||
### 🛠 Anpassungen
|
||
Falls du den Pfad der Nextcloud-Logdatei ändern möchtest, kannst du dies direkt im Python-Skript tun:
|
||
|
||
```bash
|
||
sudo nano /opt/nextcloud_log_alert/nextcloud_log_alert.py
|
||
```
|
||
Ändere die Zeile:
|
||
|
||
```python
|
||
LOG_FILE = "/home/data/nextcloud.log"
|
||
```
|
||
### 📜 Lizenz
|
||
MIT License
|
||
|