[Unit] Description=Caddy log parser After=network.target mysql.service Requires=mysql.service [Service] Environment=tcp_ip=127.0.0.1 #The address to run the tcp server on Environment=tcp_port=6969 #The port to run the tcp server on Environment=db_host=127.0.0.1 #Your mysql server address Environment=db_user=root #Your mysql user Environment=db_pass=MYSQL_PASSWORD #Your mysql password Environment=db_db=ip_logging #The database in which you log IPs User=marios ExecStart=/usr/bin/python3 /home/caddy_logger.py #Change this according to where you have the script saved #ATTENTION: Add the following under the directive you want to log from in your caddyfile #log syslog+tcp://127.0.0.1:6969 (Without the # obviously) [Install] WantedBy=multi-user.target