Sensu hook output is truncating 255 char

Hello there,

I have a check, which have a hook that produces approx 2000 chars - but somehow the output is truncated to 255 chars.

For instance:

sensuctl event info server1 check-http | jq '.check.output'
"CheckHttp CRITICAL: 200, did not find /Kristoffer_tester/ in 242 bytes: {\r\n  \"OrderNumber\": null,\r\n  \"Name\": null,\r\n  \"PlannedStartTime\": null,\r\n  \"PlannedEndTime\": null,\r\n  \"RealStartTime\": null,\r\n  \"RealEndTime\": null,\r\n  \"ExpectedBatches\": null,\r\n  \"ExecutedBatches\": n...\n"

I have tried to set “max_output_size” in the check, but that seems not to affect the hook output.

Additionally, I’m not understanding why the output of sensuctl event info gives me output like:

{
  "check": {
    ...
    "check_hooks": [
      {
        "critical": [
          "curl -X GET --header Accept: application/json https://server1"
        ]
      },

when for instance documentation shows something like:

{
  "type": "Event",
  "api_version": "core/v2",
  "metadata": {
    "namespace": "default"
  },
  "spec": {
    "check": {
      "...": "...",
      "hooks": [
        {
          "command": "df -hT / | grep '/'", 

Version is 6.9

Any pointers are greatly appreciated !

Regards
Kristoffer

Hey there. I’m not aware of hooks truncating output, but your two comparisons are likely because of the difference in the sensuctl command you used. Note in Hooks reference - Sensu Docs, the command is: sensuctl event info <entity_name> <check_name> --format wrapped-json. Specifically, it’s using wrapped-json as the output. What do you get if you change your output format?

Hi Aaronsacs,

Thanks for your reply !

I did try the different output formats, but I think in this case, my confusion is simply the difference of output from event vs the configuration of the event itself.

Still I’m not able to understand where the truncate happens - seems like a default Go configuration maybe ? Or a etcd or postgresql limit ?

Regards
Kristoffer

Hey there, I don’t think it would be something in Postgres or etcd. Let me dig some more on this and see what I can find.

Hello again Aron,

It seems I was mistaken about how the sensu hooks are defined through puppet.
I was running a command directly in the check_hooks definition, but a sensu_hook definition was required, so the check_hook points to a sensu_hook.

After this, there is no issue with output truncating from the hook :slight_smile:

Still, the issue persists with the check output, even with max_output_size defined at 4096, the output is truncated at 255.

Still this would be great to figure out why this is, so if you could point me in any direction, it would be greatly appreciated !

Regards
kristoffer

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.