LoginSignup
1
2

More than 5 years have passed since last update.

mosquitto_sub -d でデバッグログにタイムスタンプ欲しい場合

Posted at

mqttcliで-dオプション使うのが吉かと思いますが、、、

loggerを使ってみた

$ mosquitto_sub -h ブローカー -u ユーザー名 -P パスワード -t "トピック" -d | while read line
> do
>   logger -i $line
> done

出力されるログ

Jul 31 05:46:58 hostname username[19270]: Client mosqsub/19179-hostname sending CONNECT
Jul 31 05:46:58 hostname username[19271]: Client mosqsub/19179-hostname received CONNACK
Jul 31 05:46:58 hostname username[19272]: Client mosqsub/19179-hostname sending SUBSCRIBE (Mid: 1, Topic: topicprefix/device/#, QoS: 0)
Jul 31 05:46:58 hostname username[19273]: Client mosqsub/19179-hostname received SUBACK
Jul 31 05:46:58 hostname username[19274]: Subscribed (mid: 1): 0
Jul 31 05:46:58 hostname username[19275]: Client mosqsub/19179-hostname received PUBLISH (d0, q0, r0, m0, 'topicprefix/device/spam/keepalive/', ... (0 bytes))
Jul 31 05:46:58 hostname username[19276]: Client mosqsub/19179-hostname received PUBLISH (d0, q0, r0, m0, 'topicprefix/device/spam/beacon/Ham', ... (33 bytes))
Jul 31 05:46:58 hostname username[19277]: f3
1
2
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
2