Receiving Event Logs via the Message Broker
When receiving event logs with a consumer, there doesn't seem to be any message text/body. Does the message topic contain all of the available information, or am I missing something?
Comments
-
Are you using the "events over the message bus" capability to see the broker logs (rather than via Syslog export)..? I.e. subscribing to topic
#LOG/>
?Nope, there is definitely a message body on these messages. Here's a screenshot from the PubSub+ Manager TryMe! subscriber client:
So yes, I think you're missing something? 😅
1 -
Yes, that's exactly what I'm doing. Thanks for letting me know ... I'll have to look into what I'm doing wrong.
0 -
If you're using PubSub+ Manager TryMe to view them, there was a bug in the little subscriber client app not too long ago that was throwing an exception with TextMessages. My output above is from v9.9. Make sure your broker is at least on that version.
Alternatively, you should be able to see the payload using the SdkPerf test tool. Something like:
./sdkperf_java.sh -cip=localhost -cu=default@default -stl="#LOG/>" -md
0 -
Is it possible that some messages don't have any body, like CLIENT_CLIENT_CONNECT? I'm receiving a BytesXMLMessage with the JCSMP client, but getBytes() returns an empty array.
0 -
I figured it out. The content is in the attachment, not the message body.
0 -
Yup... unfortunately,
getBytes()
gets you the wrong part of the payload... it's for an XML document portion, for legacy reasons. Not great naming conventions to be stuck with. Which is why we're making a BRAND NEW JAVA API!! 🙌For anyone else who finds this thread in the future: in your JCSMP consumer, check the message type with "instanceof", then cast the message to a
BytesMessage
and then callgetData()
.Or cast it to a
TextMessage
and then callgetText()
.https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/BytesMessage.html
https://docs.solace.com/API-Developer-Online-Ref-Documentation/java/com/solacesystems/jcsmp/TextMessage.html1 -
BTW, I'd still recommend using either the Syslog logging forwarder in the broker, or (if using Docker container broker) wiring up the logging that way.
https://docs.solace.com/System-and-Software-Maintenance/Monitoring-Events-Using-Syslog.htm
https://docs.solace.com/Configuring-and-Managing/SW-Broker-Specific-Config/Docker-Tasks/Configuring-VMR-Container-Logging.htm0 -
Thanks. Are there logs available in syslog that are not sent out as events on the message bus?
0 -
Sorry @petegehrman , missed this! Yes, the logs you get over-the-message-bus are only VPN- and CLIENT-level logs for that one particular Message VPN. So really only useful for apps in there. The broker's SYSTEM-level logging, and logging for all of the other VPNs on the same broker will be emitted via Syslog or configured Docker logging. So for management/monitoring of the broker, you'll need to watch the SYSTEM-level logs.
https://docs.solace.com/Solace-PubSub-Event-Reference/event_ref_boiler.html
0