Meaning of field names in PubNub messages?


#1

Straight from the Python SDK documentation, this code lets me subscribe to the logs of a given device and process them (print them to screen in this simple snippet):

def callback(message, channel):
    print(message)


def error(message):
    print('Error:' + str(message))


PCM3_DEV2_UUID = 'eddf976f84f1124815ad4137c18ed87f'
print(resin.logs.get_channel(uuid=PCM3_DEV2_UUID))
resin.logs.subscribe(uuid=PCM3_DEV2_UUID, callback=callback, error=error)

Here is a sample output:

[{'m': "Installed service 'medusa-model sha256:d0085bc007bd08a4a0fcb61d76cec1255089247169d0e44023e743a2a94e5471'", 't': 1522938419828, 's': 1}, {'m': "Starting service 'medusa-model sha256:d0085bc007bd08a4a0fcb61d76cec1255089247169d0e44023e743a2a94e5471'", 't': 1522938419840, 's': 1}]
[{'m': 'ts=2018-04-05T14:27:00.013Z lvl=info msg="http request" service=http host=172.19.0.3 username=- start=2018-04-05T14:27:00.011810538Z method=POST uri=/write?consistency=&db=_internal&precision=ns&rp=monitor protocol=HTTP/1.1 status=204 referer=- user-agent=InfluxDBClient request-id=66e69f88-38dd-11e8-890b-000000000000 duration=2.134781ms', 't': '2018-04-05T14:27:00.015959000Z', 'c': 21940}]
[{'m': '2018-04-05T14:27:00Z E! InfluxDB Output Error: Post http://127.0.0.1:8086/write?consistency=any&db=telegraf: dial tcp 127.0.0.1:8086: getsockopt: connection refused', 't': '2018-04-05T14:27:00.305724000Z', 'c': 21944}, {'m': '2018-04-05T14:27:00Z E! Error writing to output [influxdb]: Could not write to any InfluxDB server in cluster', 't': '2018-04-05T14:27:00.326211000Z', 'c': 21944}]

Just wondering what the field names m, t, s and c might stand for? Message, timestamp and …?

Thanks in advance,

EDIT: I just stumbled upon resin-io-modules/resin-device-logs. Could it be that s stands for “system”?


#5

Hey @lv82 from https://github.com/resin-io-modules/resin-device-logs/blob/master/lib/utils.coffee#L78 the fields are:

  • m - The log message itself
  • t - The log timestamp
  • s - Is this a system message?
  • c - The id of the service which produced this log (or null)

Hope that helps!


#7

Definitely. I should have delved a little deeper after stumbling upon the repo… Thanks a lot @CameronDiver.