GCP - IOT Core Monitoring messages

277 Views Asked by At

I'm kind of new on IOT world and trying to learn a bit about GCP products. Ive made a simples python app that uses PAHO to send a message to an IOT topic (IOT Core in GCP). Everything, apparently, works just fine. But I was wondering if I could see, on stackdriver, the content of a message that the device had sent.

I already have enable debuging log for it, but the message didnt show up.

Publish Log in stackdriver:

{
 insertId:  "78178yfwnl"  
 jsonPayload: {
  eventType:  "PUBLISH"   
  protocol:  "MQTT"   
  publishFromDeviceTopicType:  "EVENTS"   
  resourceName:  "projects/demoiot/locations/us-central1/registries/iotchicago/devices/2753540639583"   
  serviceName:  "cloudiot.googleapis.com"   
  status: {
   code:  0    
  }
 }
 labels: {
  device_id:  "us_chi"   
 }
 logName:  "projects/demoiot/logs/cloudiot.googleapis.com%2Fdevice_activity"  
 receiveTimestamp:  "2018-11-20T11:10:01.123928203Z"  
 resource: {
  labels: {
   device_num_id:  "2753540639583"    
   device_registry_id:  "iotchicago"    
   location:  "us-central1"    
   project_id:  "demoiot-223010"    
  }
  type:  "cloudiot_device"   
 }
 severity:  "DEBUG"  
 timestamp:  "2018-11-20T11:10:01.104415969Z"  
}

1

There are 1 best solutions below

0
On

No telemetry data will be logged by our system. The potential for privacy concerns because of permissions to logs vs. permission on the telemetry itself is such that we didn't want to touch that.

You CAN write to Stackdriver explicitly though, so a way to do that would be to have a Cloud Function tied to the Pub/Sub topic where the telemetry is being written, and then have that function write messages out to Stackdriver with the payload data. Could also do it with DataFlow if Java is more your thing.

A teammate also pointed out to me, using the /state/ MQTT topic to write out the device's state and checking it in the GCP console is also a good way to quickly test/check. In the device details, there's a tab for "Configuration and State History" that will show you.