06 mosquitto 配置日期信息

1、在mosquitto.conf文件中插入:

#把日志信息输入到指定文件
log_dest file /MosquittoTest/DisSunLog_1.log

#在控制台输出信息,运行win服务无效
log_dest stdout

#不记录
#log_type none

#########下面的debug、error、warning.....等等可以组合使用。
#记录网络通信包,通信包大小(含心跳包),但不显示内容
log_type debug

#错误信息(没见过)
log_type error

#警告信息(没见过)
log_type warning

#设备的订阅信息、发布信息及下线信息(端口、设备名、用户、不包发布内容)
log_type notice

#服务启动关闭信息、版本号、端口号、配置文件信息
log_type information

#所有设备订阅主题提醒
log_type subscribe

#这个没有试出来干啥用的(没见过)
#log_type unsubscribe

#websockets链接信息(没见过)
#log_type websockets
#websockets_log_level 0

3、然后重启服务,我们发一条信息来看看记录了什么。
在这里插入图片描述
4、按Ctrl+C 停止主服务,如果不停止服务,日志文件会被独占锁住无法打开。找到这个日志
在这里插入图片描述
5、日志解析

##########:以下是information信息
1552112775: mosquitto version 1.5.8 starting
1552112775: Config loaded from mosquitto.conf.
1552112775: Opening ipv6 listen socket on port 1883.
1552112775: Opening ipv4 listen socket on port 1883.

##########:以下是subscribe信息(伪造)
1552113940: mosqsub|11332-DisSunPad 0 'dissun/topic'
20-DisSunPad (c1, k60, u'dissun').

##########:以下是notice信息,订阅客户端上线11332
1552112782: New connection from ::1 on port 1883.
1552112782: New client connected from ::1 as mosqsub|11332-DisSunPad (c1, k60, u'dissun').

##########:以下是debug信息,订阅客户端上线11332
1552112782: No will message specified.
1552112782: Sending CONNACK to mosqsub|11332-DisSunPad (0, 0)
1552112782: Received SUBSCRIBE from mosqsub|11332-DisSunPad
1552112782:     'dissun/topic' (QoS 0)
1552112782: mosqsub|11332-DisSunPad 0 'dissun/topic'
1552112782: Sending SUBACK to mosqsub|11332-DisSunPad

##########:以下是notice信息,发布客户端上线12284
1552112832: New connection from ::1 on port 1883.
1552112832: New client connected from ::1 as mosqpub|12284-DisSunPad (c1, k60, u'dissun').

##########:以下是debug信息,发布客户端上线12284,并发布12字节的信息,然后离线。
1552112832: No will message specified.
1552112832: Sending CONNACK to mosqpub|12284-DisSunPad (0, 0)
1552112832: Received PUBLISH from mosqpub|12284-DisSunPad (d0, q0, r0, m0, ''dissun/topic'', ... (12 bytes))
1552112832: Sending PUBLISH to mosqsub|11332-DisSunPad (d0, q0, r0, m0, ''dissun/topic'', ... (12 bytes))
1552112832: Received DISCONNECT from mosqpub|12284-DisSunPad

##########:以下是notice信息,发布客户端离线12284
1552112832: Client mosqpub|12284-DisSunPad disconnected.

##########:以下是debug信息,订阅客户端保持跟mosquitto的联系。PINGREQ请求心跳包,PINGRESP回应心跳包
1552112842: Received PINGREQ from mosqsub|11332-DisSunPad
1552112842: Sending PINGRESP to mosqsub|11332-DisSunPad
1552112902: Received PINGREQ from mosqsub|11332-DisSunPad
1552112902: Sending PINGRESP to mosqsub|11332-DisSunPad
1552112962: Received PINGREQ from mosqsub|11332-DisSunPad

##########:以下是information信息 主服务中断
1552113191: mosquitto version 1.5.8 terminating
  • 2
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值