hyperglass icon indicating copy to clipboard operation
hyperglass copied to clipboard

HTTP logging(slack) is not working

Open symysak opened this issue 1 year ago • 3 comments

Deployment Type

Docker

Version

v2.0.4

Steps to Reproduce

  1. follow this slack example :https://hyperglass.dev/configuration/config/logging

Expected Behavior

log to slack

Observed Behavior

2024-08-10 16:24:02.161 | ERROR | hyperglass.external._base:aexit:102 - 'dict' object has no attribute 'source' 2024-08-10 16:24:02.161 | ERROR | hyperglass.api.tasks:send_webhook:68 - Failed to send webhook

Configuration

No response

Devices

No response

Logs

No response

symysak avatar Aug 10 '24 16:08 symysak

I can confirm that I am seeing the same issue on a manual installation, also using Hyperglass 2.0.4 on Ubuntu 22.04.5 LTS when connecting to a VyOS router.

thesysadmindev avatar Nov 06 '24 06:11 thesysadmindev

@symysak Not sure if you managed to resolve this or not, however I worked out what the issue was and a fix.

The problem was with the way Hyperglass was trying to access a dictionary as an attribute. To access it as a key (which is what it is), you need to encapsulate it in square brackets.

To apply the fix, go to hyperglass/models/webhook.py and replace L63 with if model['source'] in ("127.0.0.1", "::1"):.

https://github.com/thatmattlove/hyperglass/blob/0b2fbb1b4d81a7042a4208aa708ac72e5ef2323d/hyperglass/models/webhook.py#L63

thesysadmindev avatar Apr 23 '25 13:04 thesysadmindev

@thesysadmindev Thanks for your patch! I am finally using the slack notification!

symysak avatar Apr 23 '25 14:04 symysak