Truncate beginning of long request bodies instead of the end

Author: StevenMassaroCreated Jan 8, 2024Updated May 7, 2026

I've started making use of the feature to send log data to healthchecks. I like that I get a truncated copy of the logs in my notification provider.

Under most circumstances I can imagine, an error in the script would show up at the end, and typically this error is truncated away.

I'm proposing a change to the truncating logic here, something like this:

    if body and maxlen and len(body) > maxlen:
        body = body[-maxlen:] + "\n[truncated]"

but I wanted to get feedback first before spending time on this change.

This would ensure that the end of the log message is included in the notification, and the beginning of the log message is omitted.

Source: healthchecks/healthchecks