Files
SMTPGraphRelay/README.md
T

138 lines
2.5 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
# SMTPGraphRelay V1.5 Log-Rotation
V1.5 erweitert V1.4 um automatische Log-Rotation und Log-Aufbewahrung.
## Standardverhalten
Ohne Änderungen an `config.json` gelten:
```text
MaxFileSizeMB = 10
RetentionDays = 30
CleanupHours = 12
```
Das aktive Log bleibt:
```text
logs\SMTPGraphRelay.log
```
Sobald es 10 MB erreicht, wird es z. B. umbenannt in:
```text
logs\SMTPGraphRelay-20260813-231500.log
```
Danach wird automatisch eine neue `SMTPGraphRelay.log` begonnen.
Archiv-Logs, die älter als 30 Tage sind, werden automatisch entfernt.
## Optionale Konfiguration
Die bestehende Config funktioniert unverändert.
Optional kann auf Root-Ebene ergänzt werden:
```json
"Logging": {
"MaxFileSizeMB": 10,
"RetentionDays": 30,
"CleanupHours": 12
}
```
Beispiel:
```json
{
"Smtp": {
"ListenAddress": "0.0.0.0",
"Port": 2525,
"Hostname": "SMTPRELAY01",
"AllowedNetworks": [
"127.0.0.1/32",
"10.0.0.0/8"
],
"MaxMessageSizeMB": 25,
"ClientTimeoutSeconds": 120,
"MaxConcurrentClients": 20
},
"Graph": {
"TenantId": "...",
"ClientId": "...",
"CertificateThumbprint": "...",
"SenderMailbox": "info@example.com",
"ForceSender": true
},
"Queue": {
"PollSeconds": 10,
"MaxRetries": 8,
"RetryMinutes": [1,5,15,30,60,120,240,480]
},
"Paths": {
"Queue": "queue",
"Failed": "failed",
"Logs": "logs"
},
"Logging": {
"MaxFileSizeMB": 10,
"RetentionDays": 30,
"CleanupHours": 12
}
}
```
## Parallel-sicher
V1.5 verwendet weiterhin den benannten Mutex:
```text
Local\SMTPGraphRelay-Log
```
Rotation und Schreiben passieren innerhalb desselben Locks. Dadurch können parallele
SMTP-Runspaces und der Queue-/Graph-Worker nicht gleichzeitig dieselbe Logdatei
rotieren oder beschreiben.
## Update von V1.4
```powershell
Stop-ScheduledTask -TaskName "SMTPGraphRelay"
Copy-Item `
"C:\Program Files\SMTPGraphRelay\SMTPGraphRelay.ps1" `
"C:\Program Files\SMTPGraphRelay\SMTPGraphRelay-V1.4-backup.ps1"
```
Dann V1.5 als:
```text
C:\Program Files\SMTPGraphRelay\SMTPGraphRelay.ps1
```
ablegen und:
```powershell
Start-ScheduledTask -TaskName "SMTPGraphRelay"
```
Im Log sollte beim Start u. a. erscheinen:
```text
SMTPGraphRelay V1.5 gestartet ...
Log-Rotation: max. 10 MB pro Datei, Aufbewahrung 30 Tage.
```
## Hinweis
Nur archivierte Dateien im Muster
```text
SMTPGraphRelay-*.log
```
werden automatisch gelöscht.
Die aktuell aktive `SMTPGraphRelay.log` wird nie durch die Retention-Regel gelöscht.