Koenkk / zigbee2mqtt

Zigbee 🐝 to MQTT bridge 🌉, get rid of your proprietary Zigbee bridges 🔨
https://www.zigbee2mqtt.io
GNU General Public License v3.0
12.07k stars 1.67k forks source link

logging to rsyslog #3647

Closed copystring closed 4 years ago

copystring commented 4 years ago

Excuse me if this has been asked before (Is this the same? https://github.com/Koenkk/zigbee2mqtt/issues/3080) I would like to have logging to a remove rsyslog server. I did fiddle around with rsyslog using the z2m log to send it off to an remove server but I was not happy with it. For example this does not allow to detect severity of the message (info, error, etc). Instead it is a fixed value like info or whatever is set in the config of rsyslog. Or does anyone know a better way to do this?

Would it be a lot of work to natively implement this into z2m?

martyzeq commented 4 years ago

it would be great to have this implemented, many users run z2m on some raspberry with system on sdcard and every log written elsewhere counts, please @Koenkk let our sdcards live longer :)

Koenkk commented 4 years ago

Zigbee2mqtt uses Winston for logging. I've checked for any rsyslog Winston plugin but they seem to heavily outdated and not maintained anymore (https://github.com/imsky/winston-rsyslog2 / https://github.com/iwater/winston-rsyslog).

There is a well maintained plugin for syslog (https://github.com/winstonjs/winston-syslog) so this would be possible to add.

Would supporting syslog fix this issue?

copystring commented 4 years ago

In my case I think it would. It does look like it is possible to send off syslog to my rsyslog server.

Koenkk commented 4 years ago

I did an initial implementation but cannot test it now.

To enable it switch to the latest dev branch https://www.zigbee2mqtt.io/how_tos/how-to-switch-to-dev-branch.html

Example configuration

advanced:
  log_output: ['console', 'syslog']
  log_syslog:
    host: my_host  # leave out to use default (localhost)
    port: 100 # leave out to use default

List of all options can be found here: https://github.com/winstonjs/winston-syslog#usage

copystring commented 4 years ago

Yeah. Cool. This works. However the host is always reported as localhost instead of the actual hostname (zigbee2mqtt in my case). Severity type works fine. Maybe the facility should be daemon instead of local0?

Edit: the syslog server and zigbee2mqtt are not running on the same machine (2 VMs) Edit2: oh. both can be edited. Never mind me. Sorry.

copystring commented 4 years ago

For me this is done. How about you @martyzeq? Then I would close this issue.

martyzeq commented 4 years ago

totally awesome 👍 thank you @Koenkk exactly what I was missing

Dylantje commented 4 years ago

pffff luckily found something about the syslog .. Lost my system and armbian forum already ended.

The syslog killed my odroid. I did update domoticz and fast after that z2m .. I did search a long time in my system for a solution. Now I find out that syslog is really something like z2m ...

Only for me the question, i come from a cli update. Where can i set syslog turn off ...

@Koenkk . Please make a setting in the config oid and put an explanation at the install wiki ... Days of misery. And my whole, there fore, stable system, bricked. Because I'm not sure what can do a syslog in my odroid. So a lot of misery.

But otherwise very happy with z2m ..

Koenkk commented 4 years ago

@Dylantje by default syslog logging is not enabled so I'm not sure what happens in your case.

Dylantje commented 4 years ago

My config: `homeassistant: false permit_join: true mqtt: base_topic: zigbee2mqtt server: 'mqtt://localhost' serial: port: /dev/ttyACM1 disable_led: false channel: 11 devices: '0x00158d0001a9e2ba': friendly_name: 'ZBX: Fietshok pir' '0x000d6ffffed65967': friendly_name: 'ZBI: Carportcam R' '0x00158d00010e4dac': friendly_name: 'ZBX: WC Pir' '0x00158d0001a4b86d': friendly_name: 'ZBXA: Woonkamer' '0x00158d00044457a5': friendly_name: 'ZBX: 33 BVTHL' '0x00158d0001b76f68': friendly_name: 'ZBX: Schakelaar over' '0x00158d000117b3fd': friendly_name: 'ZBX: Ryan Pir' '0x00158d000130d60b': friendly_name: 'ZBX: Dylan Pir' '0x00158d0001ddcd53': friendly_name: 'ZBXA: Zolder Overl Pir' '0x00158d0001a35d4e': friendly_name: 'ZBXA: 22' '0x00158d0004102c94': friendly_name: 'ZBX: 21 Over' '0x00158d000213872d': friendly_name: 'ZBXA: Vierkant 1' '0x00158d00010dcd46': friendly_name: 'ZBX: Rond 1' '0xec1bbdfffe47c996': friendly_name: 'ZB: Ikea repeater 1 [ Ryan ]' '0x00158d0001db35fb': friendly_name: 'ZBX: Carport Pir' '0x0017880100d7c02a': friendly_name: 'ZBHW: Garage R' '0x00158d0001f29be2': friendly_name: 'ZBX: Bijkeuken Pir' '0x00158d0001ddccef': friendly_name: 'ZBXA: Keuken Pir' '0x00158d00018373ad': friendly_name: 'ZBXA: Achterdeur' '0x00158d0001a64c71': friendly_name: 'ZBXA: Bijkeukendeur' '0x00158d0001a8d32e': friendly_name: 'ZBX: Gang Pir' '0x0017880100ed186c': friendly_name: 'ZBHW: Gang R' '0x0017880100dbcce7': friendly_name: 'ZBHW: Zolder R' '0x00178801063405a8': friendly_name: 'ZBHR1: Nieuw' '0x0017880100e56e0e': friendly_name: 'ZBHW: Over' '0x0017880100e612b6': friendly_name: 'ZBHK: Eettafel 1 R' '0x0017880100ffc053': friendly_name: 'ZBHK: Eettafel 2 R' '0x0017880100fedd0f': friendly_name: 'ZBHK: Zitkamer R' '0x001788010117afe5': friendly_name: 'ZBHG: Kamer TV R' '0x0017880100e8dd9d': friendly_name: 'ZBHKS: Kachel 1 R' '0x0017880100e84bd3': friendly_name: 'ZBHKS: Kachel 2 R' '0x00158d00014dc9a2': friendly_name: 'ZBX: Overloop Pir' '0x00158d000117b661': friendly_name: 'ZBX: Voordeur' '0x00158d000121b9c5': friendly_name: 'ZBX: Badkamer T&V' '0x00158d00015a9ce3': friendly_name: 'ZBX: Garage Pir' '0x00158d000149a348': friendly_name: 'ZBX: Garagedeur' '0x00158d00016da147': friendly_name: 'ZBX: Pir over' '0x34c69a000bec3df7': friendly_name: '0x34c69a000bec3df7' groups: '1': friendly_name: 'ZB: Lampen' devices:

z2m.zip In the attach my z2m map

martyzeq commented 4 years ago

It is great to have opportunity to redirect logs from z2m to syslog. You can keep whole syslog in ramdisk or (which is my favourite) have some syslog-ng listening somewhere on your NAS and gathering all logs from your raspberries, oranges, bananas and other fruits ;-) It is nice to have a choice... Many, many choices

Dylantje commented 4 years ago

I understand... Only my problem is thst the syslog kills my system. it logs to my zram from my odroid, and his in 1 or 2 hour full. And then is my system broke.

I did not config the log. Only is there a way the turn the log OFF. or perhaps otherwise make sure the log stays very small. [ can i see your config? ]

Or perhaps make sure there is a small version of info to the log? Or change the path to / so i have lot of space left . I try som config settings onl i do not knwo how to use them..

Now there a all the sensors with a lot of info: "description":"MiJia human body movement sensor","friendly_name":"ZBX: Overloop Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592003212164},{"ieeeAddr":"0x00158d0001f29be2","type":"EndDevice","networkAddress":41711,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Bijkeuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592000910537},{"ieeeAddr":"0x00158d0001ddccef","type":"EndDevice","networkAddress":64247,"model":"RTCGQ11LM","vendor":"Xiaomi","description":"Aqara human body movement and illuminance sensor","friendly_name":"ZBXA: Keuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion.aq2","hardwareVersion":1,"softwareBuildID":"3000-0001","dateCode":"201706 Jun 13 08:17:34 localhost npm[22496]: #033[32mzigbee2mqtt:info #033[39m 2020-06-13 08:17:34: MQTT publish: topic 'zigbee2mqtt/bridge/config/devices', payload '[{"ieeeAddr":"0x00124b000ffb996d","type":"Coordinator","networkAddress":0,"friendly_name":"Coordinator","softwareBuildID":"zStack30x","dateCode":"20190425","lastSeen":1592029054776},{"ieeeAddr":"0x00158d0001b76f68","type":"EndDevice","networkAddress":44795,"model":"MCCGQ01LM","vendor":"Xiaomi","description":"MiJia door & window contact sensor","friendly_name":"ZBX: Schakelaar over","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_magnet","lastSeen":1592028345249},{"ieeeAddr":"0x00158d00010e4dac","type":"EndDevice","networkAddress":52005,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: WC Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592000950704},{"ieeeAddr":"0x00158d00010dcd46","type":"EndDevice","networkAddress":19480,"model":"WXKG01LM","vendor":"Xiaomi","description":"MiJia wireless switch","friendly_name":"ZBX: Rond 1","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_switch","lastSeen":1592001271119},{"ieeeAddr":"0x00158d000213872d","type":"EndDevice","networkAddress":57011,"model":"WXKG11LM","vendor":"Xiaomi","description":"Aqara wireless switch","friendly_name":"ZBXA: Vierkant 1","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_switch.aq2","lastSeen":1592000532494},{"ieeeAddr":"0x0017880100ffc053","type":"Router","networkAddress":1769,"model":"9290012573A","vendor":"Philips","description":"Hue white and color ambiance E26/E27/E14","friendly_name":"ZBHK: Eettafel 2 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT001","hardwareVersion":3,"softwareBuildID":"5.127.1.26581","dateCode":"20181129","lastSeen":1591997600174},{"ieeeAddr":"0x0017880100e612b6","type":"Router","networkAddress":36675,"model":"9290012573A","vendor":"Philips","description":"Hue white and color ambiance E26/E27/E14","friendly_name":"ZBHK: Eettafel 1 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT001","hardwareVersion":3,"softwareBuildID":"5.127.1.26581","dateCode":"20181129","lastSeen":1591997600115},{"ieeeAddr":"0x0017880100e8dd9d","type":"Router","networkAddress":63521,"model":"8718696485880","vendor":"Philips","description":"Hue white and color ambiance GU10","friendly_name":"ZBHKS: Kachel 1 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT003","hardwareVersion":15,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600341},{"ieeeAddr":"0x0017880100e84bd3","type":"Router","networkAddress":26108,"model":"8718696485880","vendor":"Philips","description":"Hue white and color ambiance GU10","friendly_name":"ZBHKS: Kachel 2 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT003","hardwareVersion":15,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600397},{"ieeeAddr":"0x001788010117afe5","type":"Router","networkAddress":38715,"model":"7146060PH","vendor":"Philips","description":"Hue Go","friendly_name":"ZBHG: Kamer TV R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LLC020","hardwareVersion":1,"softwareBuildID":"5.127.1.26420","dateCode":"20181121","lastSeen":1591997600978},{"ieeeAddr":"0x0017880100ed186c","type":"Router","networkAddress":13330,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Gang R","manufacturerID":4116,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","hardwareVersion":1,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591999612014},{"ieeeAddr":"0x0017880100fedd0f","type":"Router","networkAddress":7203,"model":"9290012573A","vendor":"Philips","description":"Hue white and color ambiance E26/E27/E14","friendly_name":"ZBHK: Zitkamer R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT001","hardwareVersion":3,"softwareBuildID":"5.127.1.26581","dateCode":"20181129","lastSeen":1591997600223},{"ieeeAddr":"0x00178801063405a8","type":"EndDevice","networkAddress":7324,"model":"324131092621","vendor":"Philips","description":"Hue dimmer switch","friendly_name":"ZBHR1: Nieuw","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Battery","modelID":"RWL021","hardwareVersion":1,"softwareBuildID":"5.45.1.17846","dateCode":"20160302","lastSeen":1592003283712},{"ieeeAddr":"0x000d6ffffed65967","type":"Router","networkAddress":1899,"model":"E1603/E1702","vendor":"IKEA","description":"TRADFRI control outlet","friendly_name":"ZBI: Carportcam R","manufacturerID":4476,"manufacturerName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelID":"TRADFRI control outlet","hardwareVersion":1,"softwareBuildID":"2.0.024","dateCode":"20191026","lastSeen":1592028122058},{"ieeeAddr":"0x00158d0004102c94","type":"EndDevice","networkAddress":39375,"model":"WSDCGQ01LM","vendor":"Xiaomi","description":"MiJia temperature & humidity sensor","friendly_name":"ZBX: 21 Over","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sens","hardwareVersion":30,"softwareBuildID":"3000-0001","dateCode":"20160516","lastSeen":1590683264876},{"ieeeAddr":"0x0017880100d7c02a","type":"Router","networkAddress":31452,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Garage R","manufacturerID":4116,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600183},{"ieeeAddr":"0x00158d00044457a5","type":"EndDevice","networkAddress":56114,"model":"WSDCGQ01LM","vendor":"Xiaomi","description":"MiJia temperature & humidity sensor","friendly_name":"ZBX: 33 BVTHL","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_ht","lastSeen":1592002642687},{"ieeeAddr":"0x00158d0001a4b86d","type":"EndDevice","networkAddress":50901,"model":"WSDCGQ11LM","vendor":"Xiaomi","description":"Aqara temperature, humidity and pressure sensor","friendly_name":"ZBXA: Woonkamer","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.weather","lastSeen":1592028966714},{"ieeeAddr":"0x0017880100dbcce7","type":"Router","networkAddress":45883,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Zolder R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","hardwareVersion":1,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591999674508},{"ieeeAddr":"0x00158d00014dc9a2","type":"EndDevice","networkAddress":30407,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Overloop Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592003212164},{"ieeeAddr":"0x00158d0001f29be2","type":"EndDevice","networkAddress":41711,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Bijkeuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592000910537},{"ieeeAddr":"0x00158d0001ddccef","type":"EndDevice","networkAddress":64247,"model":"RTCGQ11LM","vendor":"Xiaomi","description":"Aqara human body movement and illuminance sensor","friendly_name":"ZBXA: Keuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion.aq2","hardwareVersion":1,"softwareBuildID":"3000-0001","dateCode":"20170627","lastSeen":15 Jun 13 08:17:34 localhost npm[22496]: #033[32mzigbee2mqtt:info #033[39m 2020-06-13 08:17:34: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"groups","message":[{"optimistic":true,"devices":["0x0017880100e612b6/11","0x0017880100ffc053/11","0x0017880100e84bd3/11","0x0017880100fedd0f/11","0x0017880100dbcce7/11"],"friendly_name":"ZB: Lampen","ID":1}]}' Jun 13 08:17:34 localhost npm[22496]: #033[32mzigbee2mqtt:info #033[39m 2020-06-13 08:17:34: MQTT publish: topic 'zigbee2mqtt/bridge/log', payload '{"type":"devices","message":[{"ieeeAddr":"0x00124b000ffb996d","type":"Coordinator","networkAddress":0,"friendly_name":"Coordinator","softwareBuildID":"zStack30x","dateCode":"20190425","lastSeen":1592029054792},{"ieeeAddr":"0x00158d0001b76f68","type":"EndDevice","networkAddress":44795,"model":"MCCGQ01LM","vendor":"Xiaomi","description":"MiJia door & window contact sensor","friendly_name":"ZBX: Schakelaar over","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_magnet","lastSeen":1592028345249},{"ieeeAddr":"0x00158d00010e4dac","type":"EndDevice","networkAddress":52005,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: WC Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592000950704},{"ieeeAddr":"0x00158d00010dcd46","type":"EndDevice","networkAddress":19480,"model":"WXKG01LM","vendor":"Xiaomi","description":"MiJia wireless switch","friendly_name":"ZBX: Rond 1","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_switch","lastSeen":1592001271119},{"ieeeAddr":"0x00158d000213872d","type":"EndDevice","networkAddress":57011,"model":"WXKG11LM","vendor":"Xiaomi","description":"Aqara wireless switch","friendly_name":"ZBXA: Vierkant 1","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_switch.aq2","lastSeen":1592000532494},{"ieeeAddr":"0x0017880100ffc053","type":"Router","networkAddress":1769,"model":"9290012573A","vendor":"Philips","description":"Hue white and color ambiance E26/E27/E14","friendly_name":"ZBHK: Eettafel 2 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT001","hardwareVersion":3,"softwareBuildID":"5.127.1.26581","dateCode":"20181129","lastSeen":1591997600174},{"ieeeAddr":"0x0017880100e612b6","type":"Router","networkAddress":36675,"model":"9290012573A","vendor":"Philips","description":"Hue white and color ambiance E26/E27/E14","friendly_name":"ZBHK: Eettafel 1 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT001","hardwareVersion":3,"softwareBuildID":"5.127.1.26581","dateCode":"20181129","lastSeen":1591997600115},{"ieeeAddr":"0x0017880100e8dd9d","type":"Router","networkAddress":63521,"model":"8718696485880","vendor":"Philips","description":"Hue white and color ambiance GU10","friendly_name":"ZBHKS: Kachel 1 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT003","hardwareVersion":15,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600341},{"ieeeAddr":"0x0017880100e84bd3","type":"Router","networkAddress":26108,"model":"8718696485880","vendor":"Philips","description":"Hue white and color ambiance GU10","friendly_name":"ZBHKS: Kachel 2 R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT003","hardwareVersion":15,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600397},{"ieeeAddr":"0x001788010117afe5","type":"Router","networkAddress":38715,"model":"7146060PH","vendor":"Philips","description":"Hue Go","friendly_name":"ZBHG: Kamer TV R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LLC020","hardwareVersion":1,"softwareBuildID":"5.127.1.26420","dateCode":"20181121","lastSeen":1591997600978},{"ieeeAddr":"0x0017880100ed186c","type":"Router","networkAddress":13330,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Gang R","manufacturerID":4116,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","hardwareVersion":1,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591999612014},{"ieeeAddr":"0x0017880100fedd0f","type":"Router","networkAddress":7203,"model":"9290012573A","vendor":"Philips","description":"Hue white and color ambiance E26/E27/E14","friendly_name":"ZBHK: Zitkamer R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LCT001","hardwareVersion":3,"softwareBuildID":"5.127.1.26581","dateCode":"20181129","lastSeen":1591997600223},{"ieeeAddr":"0x00178801063405a8","type":"EndDevice","networkAddress":7324,"model":"324131092621","vendor":"Philips","description":"Hue dimmer switch","friendly_name":"ZBHR1: Nieuw","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Battery","modelID":"RWL021","hardwareVersion":1,"softwareBuildID":"5.45.1.17846","dateCode":"20160302","lastSeen":1592003283712},{"ieeeAddr":"0x000d6ffffed65967","type":"Router","networkAddress":1899,"model":"E1603/E1702","vendor":"IKEA","description":"TRADFRI control outlet","friendly_name":"ZBI: Carportcam R","manufacturerID":4476,"manufacturerName":"IKEA of Sweden","powerSource":"Mains (single phase)","modelID":"TRADFRI control outlet","hardwareVersion":1,"softwareBuildID":"2.0.024","dateCode":"20191026","lastSeen":1592028122058},{"ieeeAddr":"0x00158d0004102c94","type":"EndDevice","networkAddress":39375,"model":"WSDCGQ01LM","vendor":"Xiaomi","description":"MiJia temperature & humidity sensor","friendly_name":"ZBX: 21 Over","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sens","hardwareVersion":30,"softwareBuildID":"3000-0001","dateCode":"20160516","lastSeen":1590683264876},{"ieeeAddr":"0x0017880100d7c02a","type":"Router","networkAddress":31452,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Garage R","manufacturerID":4116,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600183},{"ieeeAddr":"0x00158d00044457a5","type":"EndDevice","networkAddress":56114,"model":"WSDCGQ01LM","vendor":"Xiaomi","description":"MiJia temperature & humidity sensor","friendly_name":"ZBX: 33 BVTHL","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_ht","lastSeen":1592002642687},{"ieeeAddr":"0x00158d0001a4b86d","type":"EndDevice","networkAddress":50901,"model":"WSDCGQ11LM","vendor":"Xiaomi","description":"Aqara temperature, humidity and pressure sensor","friendly_name":"ZBXA: Woonkamer","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.weather","lastSeen":1592028966714},{"ieeeAddr":"0x0017880100dbcce7","type":"Router","networkAddress":45883,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Zolder R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","hardwareVersion":1,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591999674508},{"ieeeAddr":"0x00158d00014dc9a2","type":"EndDevice","networkAddress":30407,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Overloop Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592003212164},{"ieeeAddr":"0x00158d0001f29be2","type":"EndDevice","networkAddress":41711,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Bijkeuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592000910537},{"ieeeAddr":"0x00158d0001ddccef","type":"EndDevice","networkAddress":64247,"model":"RTCGQ11LM","vendor":"Xiaomi","description":"Aqara human body movement and illuminance sensor","friendly_name":"ZBXA: Keuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion.aq2","hardwareVersion":1,"softwareBuildID":"3000-0001","dateCode":"201706 Jun 13 08:17:35 localhost systemd[1]: Stopping zigbee2mqtt... Jun 13 08:17:35 localhost npm[22496]: #033[32mzigbee2mqtt:info #033[39m 2020-06-13 08:17:35: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'offline' Jun 13 08:17:35 localhost npm[22496]: #033[32mzigbee2mqtt:info #033[39m 2020-06-13 08:17:35: Disconnecting from MQTT server Jun 13 08:17:36 localhost npm[22496]: #033[32mzigbee2mqtt:info #033[39m 2020-06-13 08:17:36: zigbee-herdsman stopped Jun 13 08:17:36 localhost systemd[1]: zigbee2mqtt.service: Succeeded. Jun 13 08:17:36 localhost systemd[1]: Stopped zigbee2mqtt.

Dylantje commented 4 years ago

@Koenkk Please are there opties to turn the syslog off or shrink this log. My ssystem a Odroid N2 with latest armbian is not working any more with z2m.

Koenkk commented 4 years ago

@Dylantje syslog is turned off by default and has to be explicitly enabled in the config (https://github.com/Koenkk/zigbee2mqtt/issues/3647#issuecomment-638390628). As I don't see this in your config syslog logging of zigbee2mqtt is not enabled. I don't understand how it can end up in your syslog.

Dylantje commented 4 years ago

@Koenkk my config: homeassistant: false permit_join: true mqtt: base_topic: zigbee2mqtt server: 'mqtt://localhost' serial: port: /dev/ttyACM1 disable_led: false channel: 11 devices: '0x00158d0001a9e2ba': friendly_name: 'ZBX: Fietshok pir'

Works for months... Everything i did was a cli update tot latets z2m

Where can i turn on off the logging?

Or can you give me a example config that is the best way to use? [ please ] Windows noob here

Koenkk commented 4 years ago

This config is fine, it doesn't enable syslog.

If you still believe zigbee2mqtt is the issue you can try to remove syslog functionality entirely by changing /opt/zigbee2mqtt/lib/util/logger.js and remove the following code:

if (output.includes('syslog')) {
    require('winston-syslog').Syslog;
    const options = {app_name: 'zigbee2mqtt', ...settings.get().advanced.log_syslog};
    transportsToUse.push(new winston.transports.Syslog(options));
}
Dylantje commented 4 years ago

Koen, This part is not in the file you intended.

Turn on z2m is very fast a big syslog.

Koenkk commented 4 years ago

Can you provide the log when starting zigbee2mqtt?

Dylantje commented 4 years ago

syslog.zip

Hope you found a thing...

I am not sure if the end is in the log: ,"modelID":"TRADFRI control outlet","hardwareVersion":1,"softwareBuildID":"2.0.024","dateCode":"20191026","lastSeen":1592028122058},{"ieeeAddr":"0x00158d0004102c94","type":"EndDevice","networkAddress":39375,"model":"WSDCGQ01LM","vendor":"Xiaomi","description":"MiJia temperature & humidity sensor","friendly_name":"ZBX: 21 Over","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sens","hardwareVersion":30,"softwareBuildID":"3000-0001","dateCode":"20160516","lastSeen":1590683264876},{"ieeeAddr":"0x0017880100d7c02a","type":"Router","networkAddress":31452,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Garage R","manufacturerID":4116,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591997600183},{"ieeeAddr":"0x00158d00044457a5","type":"EndDevice","networkAddress":56114,"model":"WSDCGQ01LM","vendor":"Xiaomi","description":"MiJia temperature & humidity sensor","friendly_name":"ZBX: 33 BVTHL","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_ht","lastSeen":1592002642687},{"ieeeAddr":"0x00158d0001a4b86d","type":"EndDevice","networkAddress":50901,"model":"WSDCGQ11LM","vendor":"Xiaomi","description":"Aqara temperature, humidity and pressure sensor","friendly_name":"ZBXA: Woonkamer","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.weather","lastSeen":1592028966714},{"ieeeAddr":"0x0017880100dbcce7","type":"Router","networkAddress":45883,"model":"433714","vendor":"Philips","description":"Hue Lux A19 bulb E27","friendly_name":"ZBHW: Zolder R","manufacturerID":4107,"manufacturerName":"Philips","powerSource":"Mains (single phase)","modelID":"LWB004","hardwareVersion":1,"softwareBuildID":"5.130.1.30000","dateCode":"20191216","lastSeen":1591999674508},{"ieeeAddr":"0x00158d00014dc9a2","type":"EndDevice","networkAddress":30407,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Overloop Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592003212164},{"ieeeAddr":"0x00158d0001f29be2","type":"EndDevice","networkAddress":41711,"model":"RTCGQ01LM","vendor":"Xiaomi","description":"MiJia human body movement sensor","friendly_name":"ZBX: Bijkeuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion","lastSeen":1592145820697},{"ieeeAddr":"0x00158d0001ddccef","type":"EndDevice","networkAddress":64247,"model":"RTCGQ11LM","vendor":"Xiaomi","description":"Aqara human body movement and illuminance sensor","friendly_name":"ZBXA: Keuken Pir","manufacturerID":4151,"manufacturerName":"LUMI","powerSource":"Battery","modelID":"lumi.sensor_motion.aq2","hardwareVersion":1,"softwareBuildID":"3000-0001","dateCode":"2017062 Jun 14 16:46:36 localhost CRON[6953]: (CRON) info (No MTA installed, discarding output) Jun 14 16:46:39 localhost systemd[1]: Stopping zigbee2mqtt... Jun 14 16:46:39 localhost npm[2898]: #033[32mzigbee2mqtt:info #033[39m 2020-06-14 16:46:39: MQTT publish: topic 'zigbee2mqtt/bridge/state', payload 'offline' Jun 14 16:46:39 localhost npm[2898]: #033[32mzigbee2mqtt:info #033[39m 2020-06-14 16:46:39: Disconnecting from MQTT server Jun 14 16:46:40 localhost npm[2898]: #033[32mzigbee2mqtt:info #033[39m 2020-06-14 16:46:40: zigbee-herdsman stopped Jun 14 16:46:40 localhost systemd[1]: zigbee2mqtt.service: Succeeded. Jun 14 16:46:40 localhost systemd[1]: Stopped zigbee2mqtt.

Koenkk commented 4 years ago

Can you post your /opt/zigbee2mqtt/lib/util/logger.js file here?

Dylantje commented 4 years ago

lib.zip

Perhaps my whol map?

For your idea.. Worked fine for monds [ Domoticze latest beta ]

This problem i did have with my "old" system, when i upgrade to z2m 14.

Was thinking armbian, or domoticz errors.. So a lot searching on different forum.... syslog and z2m should be the problem.

I make a lot of changes in a lot places. So my ondriod was instable. [ windows noob so stupid changes, what i have read on forum ]

So i was thinking everything new/clean should be better. :-)

Newest version of odroid/armbian Newest version of Domoticz Newest version of z2m

Only the map data i replaced after the clean install.

Same problem as the old setup :-(

Koenkk commented 4 years ago

The lines I mentioned in https://github.com/Koenkk/zigbee2mqtt/issues/3647#issuecomment-643773530 are on line 83. If after removing that the problem still occurs, it's for sure not zigbee2mqtt itself logging to syslog.

Dylantje commented 4 years ago

sorry did not fin the lines. [ used the search int he document ]

Removed the lines. Save the file. start z2m Reboot the odroid.

Only no differences.. Can i not remove the whole logging or somthing like that?

I use also the z2m plugin from your site.. Perhaps there a setting? Update that also the latest version?

Can i go back to 1.12 or 1,13 ? How please..

copystring commented 4 years ago

@Koenkk does it make sense to change messages in syslog to just the actual message instead of the full json? Right now it looks like this: {"message":"Failed to ping 'TerassenlichtRechts'","level":"error"} Make it look like Failed to ping 'TerassenlichtRechts' and it is a lot more readable.

magcode commented 4 years ago

I also have this issue, when sending log data to the TICK stack. I tried to fiddle around with json: false as a config option. But no success. JSON seems to be coming from winston-syslog

Koenkk commented 4 years ago

Indeed seems to be coming from winston-syslog and there are no options to control this behaviour (if I read correctly), please open an issue https://github.com/winstonjs/winston-syslog/issues to see if they can consider this.

magcode commented 4 years ago

I checked again.

It seems we can control it ourselfes. This is working fine:

  require('winston-syslog').Syslog;
  const { format } = require('logform');

  const mostSimpleFormat = format.printf(info => `${info.message}`)

  const winston = require('winston');

  options={}
  options.app_name="hello"
  options.host="myserver"
  options.port=6514
  options.protocol="udp4"
  options.type="5424"

  const logger = winston.createLogger({
    levels: winston.config.syslog.levels,
    format: mostSimpleFormat,
    transports: [    
      new winston.transports.Syslog(options)
    ]
  });
logger.info('Clean');

So the thing is to explictely pass a very simple format.

Koenkk commented 4 years ago

Cool, I missed that. Does this also include the log level itself? Feel free to make a PR .

magcode commented 4 years ago

I don't think the level is needed. Its already provided to syslog in a structured manner Here is an example when pushing the sample above via syslog to some logging visualization tool:

logger.info('clean');
logger.error('clean');

image

Alright. Will create a dedicated ticket and my first PR (excited)

Koenkk commented 4 years ago

In that case forget my comment, looks good :)