Skip to content

Instantly share code, notes, and snippets.

@GongT
Created October 29, 2018 08:27
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save GongT/3329814fcc894c4961fbba8e334193bd to your computer and use it in GitHub Desktop.
Save GongT/3329814fcc894c4961fbba8e334193bd to your computer and use it in GitHub Desktop.
a service file to redirect Privoxy log file to journald
```bash
journalctl -ft privoxy
```
# /etc/systemd/system/privoxy-logging.service
[Unit]
Before=privoxy.serivce
[Service]
Environment=LOGGING_FILE=/var/log/privoxy/logfile
Type=simple
ExecStartPre=-/usr/bin/unlink "${LOGGING_FILE}"
#ExecStartPre=/usr/bin/mkfifo -m 0777 "${LOGGING_FILE}"
ExecStartPre=/usr/bin/touch "${LOGGING_FILE}"
ExecStartPost=/usr/bin/chmod 0777 "${LOGGING_FILE}"
ExecStart=/usr/bin/systemd-cat --identifier=privoxy /bin/sh -c 'stdbuf -o0 tail -f "${LOGGING_FILE}" | stdbuf -o0 -i0 sed -E "s/[0-9-]+ [0-9:.]+ [0-9a-fA-F]+ //g"'
# ExecStart=/bin/sh -c 'stdbuf -o0 tail -f "${LOGGING_FILE}" | stdbuf -o0 -i0 sed -E "s/[0-9-]+ [0-9:.]+ [0-9a-fA-F]+ //g"'
# ExecStart=/usr/bin/tail -f "${LOGGING_FILE}"
ExecStopPost=-/usr/bin/unlink "${LOGGING_FILE}"
[Install]
WantedBy=local-fs
RequiredBy=privoxy.serivce
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment