mirror of
https://github.com/kernelkit/infix.git
synced 2026-07-29 20:23:01 +02:00
confd: rename syslog format -> log-format, add must expression
- For consistency and clarity, rename format -> log-format
- Add must expression to ban 'bsd' format from file logging
Note: technically, sysklogd silently reverts back to rfc3164 for file
logging, but it's better to be clear with the user with what is
possible to configure and is going to be used.
Signed-off-by: Joachim Wiberg <troglobit@gmail.com>
This commit is contained in:
@@ -156,7 +156,7 @@ static void action(sr_session_ctx_t *session, const char *name, const char *xpat
|
||||
sep = ",";
|
||||
}
|
||||
|
||||
fmt = srx_get_str(session, "%s/format", xpath);
|
||||
fmt = srx_get_str(session, "%s/log-format", xpath);
|
||||
if (fmt) {
|
||||
char *ptr = strchr(fmt, ':'); /* skip any prefix */
|
||||
|
||||
|
||||
@@ -20,7 +20,7 @@ MODULES=(
|
||||
# NOTE: ietf-tls-client must be version matched with ietf-tls-server, used by netopeer2!
|
||||
"ietf-tls-client@2023-12-28.yang" # used by ietf-syslog (remote)
|
||||
"ietf-syslog@2024-03-21.yang -e file-action -e file-limit-size -e remote-action"
|
||||
"infix-syslog@2024-07-18.yang"
|
||||
"infix-syslog@2024-07-19.yang"
|
||||
"iana-hardware@2018-03-13.yang"
|
||||
"ietf-hardware@2018-03-13.yang -e hardware-state"
|
||||
"infix-hardware@2024-04-25.yang"
|
||||
|
||||
+11
-9
@@ -16,7 +16,7 @@ module infix-syslog {
|
||||
contact "kernelkit@googlegroups.com";
|
||||
description "Infix augments and deviations to ietf-syslog, draft 32.";
|
||||
|
||||
revision 2024-07-18 {
|
||||
revision 2024-07-19 {
|
||||
description "Initial revision, based on IETF syslog YANG draft 32.
|
||||
The following changes have been made in this model:
|
||||
|
||||
@@ -76,16 +76,15 @@ module infix-syslog {
|
||||
* Shared settings
|
||||
*/
|
||||
|
||||
grouping format {
|
||||
leaf format {
|
||||
grouping log-format {
|
||||
leaf log-format {
|
||||
description "Log format, one of: BSD*, RFC3164, or RFC5424.
|
||||
|
||||
BSD : myproc[8710]: Kilroy was here.
|
||||
RFC3164 : Aug 24 05:14:15 192.0.2.1 myproc[8710]: Kilroy was here.
|
||||
RFC5424 : 2003-08-24T05:14:15.000003-07:00 192.0.2.1 myproc 8710 - - Kilroy was here.
|
||||
|
||||
Please note, BSD format is only applicable to remote logging.
|
||||
Specifying BSD for log-file action will revert to RFC3164.";
|
||||
Please note, BSD format is only applicable to remote logging.";
|
||||
type identityref {
|
||||
base format-type;
|
||||
}
|
||||
@@ -157,17 +156,20 @@ module infix-syslog {
|
||||
|
||||
augment "/syslog:syslog/syslog:actions/syslog:file/syslog:log-file" {
|
||||
description "Configurable log format for file logging.";
|
||||
uses format {
|
||||
refine format {
|
||||
uses log-format {
|
||||
refine log-format {
|
||||
default rfc3164;
|
||||
must "not(../log-format = 'infix-syslog:bsd')" {
|
||||
error-message "BSD log format is not applicable to file logging, only remote.";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
augment "/syslog:syslog/syslog:actions/syslog:remote/syslog:destination" {
|
||||
description "Configurable log format for remote logging.";
|
||||
uses format {
|
||||
refine format {
|
||||
uses log-format {
|
||||
refine log-format {
|
||||
default bsd;
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user