mirror of
https://github.com/arendst/Tasmota.git
synced 2025-07-24 03:06:33 +00:00
Format syslog messages according to RFC5424 adding local log time (#23509)
This commit is contained in:
parent
7c2eabcd94
commit
bba5ba008e
@ -26,7 +26,8 @@ All notable changes to this project will be documented in this file.
|
||||
- Berry change number parser for json to reuse same parser as lexer (#23505)
|
||||
- Berry increase web hooks from 16 to 32 (#23507)
|
||||
- ESP32 LVGL library from v9.2.2 to v9.3.0 (#23518)
|
||||
- Zigbee improved message when coordinator failed to start
|
||||
- Zigbee improved message when coordinator failed to start (#23525)
|
||||
- Format syslog messages according to RFC5424 adding local log time (#23509)
|
||||
|
||||
### Fixed
|
||||
- Haspmota `haspmota.parse()` page parsing (#23403)
|
||||
|
@ -144,6 +144,8 @@ The latter links can be used for OTA upgrades too like ``OtaUrl https://ota.tasm
|
||||
- GPIOViewer from v1.6.2 to v1.6.3 (No functional change)
|
||||
- Allow command `WebRefresh` minimum from 1000 to 400 mSec
|
||||
- Increase number of supported LoRaWan nodes from 4 to 16
|
||||
- Format syslog messages according to RFC5424 adding local log time [#23509](https://github.com/arendst/Tasmota/issues/23509)
|
||||
- Zigbee improved message when coordinator failed to start [#23525](https://github.com/arendst/Tasmota/issues/23525)
|
||||
- Berry change number parser for json to reuse same parser as lexer [#23505](https://github.com/arendst/Tasmota/issues/23505)
|
||||
- Berry increase web hooks from 16 to 32 [#23507](https://github.com/arendst/Tasmota/issues/23507)
|
||||
|
||||
|
@ -2462,7 +2462,7 @@ void SyslogAsync(bool refresh) {
|
||||
return;
|
||||
}
|
||||
|
||||
char header[64];
|
||||
char header[100];
|
||||
/* Legacy format (until v13.3.0.1) - HOSTNAME TAG: MSG
|
||||
SYSLOG-MSG = wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
Result = 2023-12-20T13:41:11.825749+01:00 wemos5 ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
@ -2484,11 +2484,7 @@ void SyslogAsync(bool refresh) {
|
||||
LOG_LEVEL_DEBUG 3 -> severity level 7 - Debug
|
||||
LOG_LEVEL_DEBUG_MORE 4 -> severity level 7 - Debug
|
||||
*/
|
||||
snprintf_P(header, sizeof(header), PSTR("<%d>%s ESP-"), 128 + min(loglevel * 3, 7), NetworkHostname());
|
||||
|
||||
// SYSLOG-MSG = <134>wemos5 Tasmota HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
// Result = 2023-12-21T11:31:50.378816+01:00 wemos5 Tasmota HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
// snprintf_P(header, sizeof(header), PSTR("<134>%s Tasmota "), NetworkHostname());
|
||||
// snprintf_P(header, sizeof(header), PSTR("<%d>%s ESP-"), 128 + min(loglevel * 3, 7), NetworkHostname());
|
||||
|
||||
/* RFC3164 - BSD syslog protocol - <PRI>TIMESTAMP HOSTNAME TAG: MSG
|
||||
<PRI> = Facility 16 (= local use 0), Severity 6 (= informational) => 16 * 8 + 6 = <134>
|
||||
@ -2500,11 +2496,7 @@ void SyslogAsync(bool refresh) {
|
||||
*/
|
||||
// snprintf_P(header, sizeof(header), PSTR("<134>%s %s ESP-"), GetSyslogDate(line).c_str(), NetworkHostname());
|
||||
|
||||
// SYSLOG-MSG = <134>Jan 1 00:00:02 wemos5 Tasmota HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
// Result = 2023-01-01T00:00:02+01:00 wemos5 Tasmota HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
// snprintf_P(header, sizeof(header), PSTR("<134>%s %s Tasmota "), GetSyslogDate(line).c_str(), NetworkHostname());
|
||||
|
||||
/* RFC5425 - Syslog protocol - <PRI>VERSION TIMESTAMP HOSTNAME APP_NAME PROCID STRUCTURED-DATA MSGID MSG
|
||||
/* RFC5424 - Syslog protocol - <PRI>VERSION TIMESTAMP HOSTNAME APP_NAME PROCID STRUCTURED-DATA MSGID MSG
|
||||
<PRI> = Facility 16 (= local use 0), Severity 6 (= informational) => 16 * 8 + 6 = <134>
|
||||
VERSION = 1
|
||||
TIMESTAMP = yyyy-mm-ddThh:mm:ss.nnnnnn-hh:mm (= local with timezone)
|
||||
@ -2516,17 +2508,22 @@ void SyslogAsync(bool refresh) {
|
||||
Result = 1970-01-01T00:00:02.096000+00:00 wemos5 Tasmota ESP-HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
Notice date and time is provided by Tasmota device.
|
||||
*/
|
||||
// char line_time[mxtime];
|
||||
// subStr(line_time, line, " ", 1); // 00:00:02.096-026
|
||||
// subStr(line_time, line_time, "-", 1); // 00:00:02.096
|
||||
// String systime = GetDate() + line_time + "000" + GetTimeZone(); // 1970-01-01T00:00:02.096000+01:00
|
||||
// snprintf_P(header, sizeof(header), PSTR("<134>1 %s %s Tasmota - - ESP-"), systime.c_str(), NetworkHostname());
|
||||
|
||||
// SYSLOG-MSG = <134>1 1970-01-01T00:00:02.096000+01:00 wemos5 Tasmota - - HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
// Result = 1970-01-01T00:00:02.096000+00:00 wemos5 Tasmota HTP: Web server active on wemos5 with IP address 192.168.2.172
|
||||
// snprintf_P(header, sizeof(header), PSTR("<134>1 %s %s Tasmota - - "), systime.c_str(), NetworkHostname());
|
||||
char line_time[mxtime];
|
||||
subStr(line_time, line, " ", 1); // 00:00:02.096-026
|
||||
subStr(line_time, line_time, "-", 1); // 00:00:02.096
|
||||
String systime = GetDate() + line_time + "000" + GetTimeZone(); // 1970-01-01T00:00:02.096000+01:00
|
||||
// snprintf_P(header, sizeof(header), PSTR("<%d>1 %s %s tasmota - - ESP-"), 128 + min(loglevel * 3, 7), systime.c_str(), NetworkHostname());
|
||||
snprintf_P(header, sizeof(header), PSTR("<%d>1 %s %s tasmota - - -"), 128 + min(loglevel * 3, 7), systime.c_str(), NetworkHostname());
|
||||
|
||||
char* line_start = line +mxtime;
|
||||
/*
|
||||
TasConsole.printf("Header: '");
|
||||
TasConsole.printf(header);
|
||||
TasConsole.printf("', line: '");
|
||||
TasConsole.write((uint8_t*)line_start, len -mxtime -1);
|
||||
TasConsole.printf("'\r\n");
|
||||
*/
|
||||
|
||||
#ifdef ESP8266
|
||||
// Packets over 1460 bytes are not send
|
||||
uint32_t line_len;
|
||||
|
Loading…
x
Reference in New Issue
Block a user