add checksum to nginx log entries

Francis Daly francis at daoine.org
Tue Sep 4 07:21:10 UTC 2018


On Mon, Sep 03, 2018 at 09:26:42AM -0400, prajos wrote:

Hi there,

> I'm wondering if there is a ready way to add a checksum (e.g. CRC) to the
> end of each log entry before they get written to the "access" or "error" log
> files?

I believe that stock nginx does not include a way to do that.

> One of the project I work on wants each log line to have its own
> checksum for some integrity checks.

What kind of corruption is the checksum intended to protect against?

The answer to that might help determine a suitable design for a solution
for you.

> Any hint on how I can implement these would be of great help. 

If it is acceptable to be outside nginx, you could have something that
post-processed the logs to add whatever marks you want.

Or maybe you could write nginx logs to a named pipe, and have another
process do whatever you want before writing to "real" disk.

Good luck with it,

	f
-- 
Francis Daly        francis at daoine.org


More information about the nginx mailing list