custom logfile_daemon causing FATAL error

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

custom logfile_daemon causing FATAL error

bestluxna1
Greetings all, 

I have been attempting to write my own logfile_daemon for experimental purposes, but any daemon I provide causes "FATAL: I don't handle this error well". I also see "logfileHandleWrite: daemon:/var/log/squid/access.log: error writing ((32) Broken pipe)" with no other errors in the cache.log. I have read all possible docs about writing a custom logfile_daemon, but I have had no luck. For testing purposes my daemon is just a bash script that creates a file and pipes random text to it. The creation of the file/writing text to the file works fine, but soon after squid just dies. I have no help from the cache.log or squid.out.

The only line I have added to my squid.conf is "logfile_daemon /etc/squid/hi.sh". This causes the fatal error. I have also tried explicitly setting my access_log directive as well "access_log daemon:/var/log/squid/access.log squid", but that still does not work. Thanks in advance.

-Mike


_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users
Reply | Threaded
Open this post in threaded view
|

Re: custom logfile_daemon causing FATAL error

Alex Rousskov
On 02/10/2018 05:51 PM, Michael D wrote:
> Greetings all, 
>
> I have been attempting to write my own logfile_daemon for experimental
> purposes, but any daemon I provide causes "FATAL: I don't handle this
> error well". I also see "logfileHandleWrite:
> daemon:/var/log/squid/access.log: error writing ((32) Broken pipe)" with
> no other errors in the cache.log.

It sounds like your daemon quits without Squid permission. Logging
daemons should not do that because Squid considers such behavior a FATAL
error.


> I have read all possible docs about
> writing a custom logfile_daemon, but I have had no luck. For testing
> purposes my daemon is just a bash script that creates a file and pipes
> random text to it. The creation of the file/writing text to the file
> works fine, but soon after squid just dies. I have no help from the
> cache.log or squid.out.

Since you did not share your code, I have to ask: Does your shell script
actually read logging commands sent by Squid? Or does it simply quit
after writing some "random text" to some file? Squid expects the daemon
to run until the daemon reads EOF on stdin... The daemon does not have
to handle the commands it reads, but it has to keep reading them until EOF.

If you want to add debugging to your daemon, try writing write to stderr.

For the list of logging commands, please see
https://wiki.squid-cache.org/Features/LogModules#Daemon_Message_Protocol
a.k.a.
https://wiki.squid-cache.org/Features/AddonHelpers#Logging


HTH,

Alex.


> The only line I have added to my squid.conf is "logfile_daemon
> /etc/squid/hi.sh". This causes the fatal error. I have also tried
> explicitly setting my access_log directive as well "access_log
> daemon:/var/log/squid/access.log squid", but that still does not work.
> Thanks in advance.
>
> -Mike
>
>
>
>
> _______________________________________________
> squid-users mailing list
> [hidden email]
> http://lists.squid-cache.org/listinfo/squid-users
>

_______________________________________________
squid-users mailing list
[hidden email]
http://lists.squid-cache.org/listinfo/squid-users