Hi just been getting to know CS v4 very impressed. I’ve used older versions on Gateways.
One thing I wanted was to be able to stash raw logs to a DB. I’m a scripter not a Developer so with the aid of Ghatgpt I got it to convert an example form Go to Python.
After many blind alleys I have a POC that might be of use to others. Brian @bconway I tried to take the lead from a post a while back and use MQTT but it looks like the protoBuf is different on inbound MQTT to that used for REDIS logging.
One thing for joins the “mType”: key doesn’t get set but I can see it’s join as the “devEui” is set.
Hi Brian I took my approach from reading the Docs. There is no “Gateway Logging Service” in API the documentation. And [Features/Logging] “Frame logging: ChirpStack provides an option to log all uplink and downlink frames to a Redis stream, which can be consumed by external application(s) for monitoring or logging purposes.”
I tried that as that’s what you recommended in a post on the Forum. But get this error google.protobuf.message.DecodeError: Error parsing message. The protoBuf length is quite different between MQTT payload and REDIS read. Any thoughts?
File "/home/chirplns/.local/mqtt_gw_frame_logger.py", line 25, in on_message
pl.ParseFromString(b) google.protobuf.message.DecodeError: Error parsing message
great work, been meaning to try and get the frames for greater metrics for logging and testing purposes for a while.
did you manage to decode the mqtt gateway topic? Not being familiar with grpc/protobuf and lacking understanding how to use it i usually use the http api integration - but i cannot get the gateway frames this way. there are basically no examples anywhere either
sorry to tag you @bconway but is this what you do? If so are you able to elaborate on how i would decode the mqtt gateway protobuf. unfortunately i usually use python as well for almost all my scripting.
Sure. Assuming you’re looking for tips on how to decode the protobuf and not an approach to pulling from MQTT, here’s an example of decoding gateway Stats. Note that it’s all in Go, I don’t do much Python these days:
That directory has decoding of other gateway payloads (Uplink, etc). They use an intermediary Point KV type that is used by the larger platform.
thanks for replying - i will try decode the mqtt messages with that protobuf you linked (not that i’m 100% sure on exactly what I’m doing with grpc/protobuf as I’ve never used it before).
the difference I found so far was the redis stream and code iiLaw posted provides the gateway frames which is what i was interested in so i can log the other traffic around me and what type of msg they are. I currently do this with a python script by reading the docker logs and picking up the unknown devices.
i did run a modified version of his script which worked fine for a few hours but it seems to of killed the redis db and dropped all the assigned activated device addresses although that could of been something else stupid unrelated i did lol.
i think the reason the other code doesn’t work is because when i changed it to json it is not the same payload - it looks more aligned with the gist you sent (ill check this tomorrow).
this seems to be the address to console that we’re needing to decode
Yeah, the internal service endpoints are there to support the web UI and are subject to sudden changes. I already mentioned this above, but I would not advise tapping the Redis streams for pulling data for the same reason.