[Unit]
Description=IDS Syslog Parser (Network Logs Processor)
After=network.target postgresql-16.service rsyslog.service
Wants=postgresql-16.service

[Service]
Type=simple
User=ids
Group=ids
WorkingDirectory=/opt/ids/python_ml
EnvironmentFile=/opt/ids/.env

# Comando esecuzione (usa virtual environment)
ExecStart=/opt/ids/python_ml/venv/bin/python3 syslog_parser.py

# Restart automatico sempre (non solo on-failure)
Restart=always
RestartSec=10
StartLimitInterval=300
StartLimitBurst=5

# Limiti risorse
LimitNOFILE=65536
MemoryMax=1G

# Logging
StandardOutput=append:/var/log/ids/syslog_parser.log
StandardError=append:/var/log/ids/syslog_parser.log
SyslogIdentifier=ids-syslog-parser

[Install]
WantedBy=multi-user.target
