| 1 |
[Unit] |
| 2 |
Description=mtail - extract internal monitoring data from application logs for collection in a timeseries database |
| 3 |
Documentation=https://jaqx0r.github.io/mtail/ |
| 4 |
Requires=local-fs.target network.target |
| 5 |
Before=nss-user-lookup.target |
| 6 |
After=local-fs.target network.target |
| 7 |
|
| 8 |
[Service] |
| 9 |
Type=exec |
| 10 |
Restart=on-failure |
| 11 |
User=mtail |
| 12 |
|
| 13 |
Environment=HOST=:: |
| 14 |
Environment=PORT=3903 |
| 15 |
Environment=EXTRA_ARGS= |
| 16 |
EnvironmentFile=/etc/default/mtail |
| 17 |
|
| 18 |
ExecCondition=/usr/bin/test -n "${LOGS}" |
| 19 |
ExecStart=/bin/sh -c 'exec /usr/bin/mtail --progs /etc/mtail --logtostderr $${HOST:+--address $$HOST} $${PORT:+--port $$PORT} --logs "$LOGS" $EXTRA_ARGS' |
| 20 |
ExecReload=/bin/kill -HUP $MAINPID |
| 21 |
TimeoutStopSec=20s |
| 22 |
|
| 23 |
# Limit memory leaks |
| 24 |
MemoryMax=1G |
| 25 |
MemorySwapMax=0 |
| 26 |
|
| 27 |
# Various hardening options |
| 28 |
ProtectSystem=full |
| 29 |
AmbientCapabilities= |
| 30 |
CapabilityBoundingSet= |
| 31 |
KeyringMode=private |
| 32 |
LockPersonality=yes |
| 33 |
MemoryDenyWriteExecute=yes |
| 34 |
MountFlags=private |
| 35 |
NoNewPrivileges=yes |
| 36 |
PrivateDevices=yes |
| 37 |
PrivateTmp=yes |
| 38 |
PrivateUsers=yes |
| 39 |
ProtectClock=yes |
| 40 |
ProtectControlGroups=yes |
| 41 |
ProtectHome=yes |
| 42 |
ProtectHostname=yes |
| 43 |
ProtectKernelLogs=yes |
| 44 |
ProtectKernelModules=yes |
| 45 |
ProtectKernelTunables=yes |
| 46 |
RemoveIPC=yes |
| 47 |
RestrictAddressFamilies=AF_INET AF_INET6 AF_UNIX |
| 48 |
RestrictNamespaces=yes |
| 49 |
RestrictRealtime=yes |
| 50 |
RestrictSUIDSGID=yes |
| 51 |
|
| 52 |
[Install] |
| 53 |
WantedBy=multi-user.target |