Question

I have a server with supervisor running an eventlistener, on the event when the process crashes, I managed to get crashmail to send an email to me. But the email content only states "Process adnode04 in group adnode04 exited unexpectedly (pid 1255) from state RUNNING".

I want crashmail to be able to take content from the last 10-20 lines of the log file and email me the contents. Is it able to do that?

Was it helpful?

Solution

Absolutely, but you will have to fork crashmail yourself.

The message is around line 112. You can use the XML-RPC API to call tailProcessStderrLog.

So what you'd basically do is add something like:

rpc = childutils.getRPCInterface( os.environ )
log = rpc.supervisor.tailProcessStderrLog( %(groupname):'%(processname)' % pheaders, 16000 )
msg += '\nLog:\n%s' % log['bytes']

The above is a simple proof-of-concept, untested and very probably contains a mistake. Let me know how it goes.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top