From 9c0c0a09400a70ae05eec6e421cfd728077cec61 Mon Sep 17 00:00:00 2001 From: "Zsolt Gyulai (zgyulai)" Date: Thu, 21 Aug 2025 10:27:57 +0200 Subject: [PATCH 1/2] Included $(getent) which was missing. Signed-off-by: Zsolt Gyulai (zgyulai) --- .../007_Template_functions_of_syslog-ng.md | 62 +++++++++++++++++++ 1 file changed, 62 insertions(+) diff --git a/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md b/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md index f69e4b0c..b93fedb0 100644 --- a/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md +++ b/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md @@ -351,6 +351,68 @@ Starting with version 3.24, {{ site.product.short_name }} tries to automatically the location of the database. If that is successful, the database() option is not mandatory. +## $(getent) + +|*Syntax:*|$(getent)| + +Available in syslog-ng OSE 3.13 and later. + +*Description:* You can use the `getent` template function to look up entries from the Name Service Switch libraries, such as, passwd, services, or protocols. + +The following databases are supported: + +- passwd + + Use this database to query data related to a user. Specify the user by either username or user ID. You can query the following data: username, user ID, group ID, GECOS field, home directory, or user shell. + ```config + $(getent passwd testuser name) + $(getent passwd testuser uid) + $(getent passwd testuser gid) + $(getent passwd testuser gecos) + $(getent passwd testuser dir) + $(getent passwd testuser shell) + ``` + or + ```config + $(getent passwd 1000 name) + $(getent passwd 1000 uid) + $(getent passwd 1000 gid) + $(getent passwd 1000 gecos) + $(getent passwd 1000 dir) + $(getent passwd 1000 shell) + ``` + The queried data is optional. When you do not query any data, the default behavior applies, which is as follows: user ID is returned for username, or username is returned for user ID. + - Username `$(getent passwd testuser)` returns user `ID 1000`. + - User ID `$(getent passwd 1000)` returns username `testuser`. +- group + + Use this database to query group-related data. The group can be specified using either group ID or group name. You can query the following data: group name, group ID, and members. + ```config + $(getent group adm name) + $(getent group adm gid) + $(getent group adm members) + ``` + The queried data is optional. The default behavior is as follows: group ID is returned for group name, or group name is returned for user ID. + - Group name `$(getent group adm)` returns group ID `4`. + - Group ID `$(getent group 4)` returns group name `adm`. + +- protocols + + Use this database to translate protocol name to protocol ID, or protocol ID to protocol string. + ```config + $(getent protocols tcp) + $(getent protocols 6) + ``` + +- services + + Use this database to translate service name to service ID, or service ID to service name. + ```config + $(getent services http) + $(getent services 80) + ``` + + ## $(graphite-output) |*Syntax:*|$(graphite-output parameters)| From 88871468c8f896379d9dbaa6c1c0d644f2000e8a Mon Sep 17 00:00:00 2001 From: "Zsolt Gyulai (zgyulai)" Date: Thu, 21 Aug 2025 11:36:57 +0200 Subject: [PATCH 2/2] Replaced syslog-ng OSE with variable. Signed-off-by: Zsolt Gyulai (zgyulai) --- .../007_Template_functions_of_syslog-ng.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md b/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md index b93fedb0..3f0e6d9e 100644 --- a/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md +++ b/doc/_admin-guide/110_Template_and_rewrite/000_Customize_message_format/007_Template_functions_of_syslog-ng.md @@ -355,7 +355,7 @@ option is not mandatory. |*Syntax:*|$(getent)| -Available in syslog-ng OSE 3.13 and later. +Available in {{ site.product.short_name }} 3.13 and later. *Description:* You can use the `getent` template function to look up entries from the Name Service Switch libraries, such as, passwd, services, or protocols.