Created
October 29, 2018 08:27
-
-
Save GongT/3329814fcc894c4961fbba8e334193bd to your computer and use it in GitHub Desktop.
a service file to redirect Privoxy log file to journald
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
```bash | |
journalctl -ft privoxy | |
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# /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