Skip to content

Commit 3e3c756

Browse files
committed
Update PR sonic-net#70 with note about HUP and new section on resource usage.
1 parent d463f0e commit 3e3c756

File tree

1 file changed

+29
-10
lines changed

1 file changed

+29
-10
lines changed

system/syslog-msg-intf-name-xlate-HLD.md

+29-10
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ Syslog Message Interface Name Translation
55

66
# High Level Design Document
77

8-
#### Rev 0.7
8+
#### Rev 0.8
99

1010
# Table of Contents
1111

@@ -34,6 +34,7 @@ Syslog Message Interface Name Translation
3434
| 0.5 | 08/03/2020 | Greg Paussa | Handle non-base breakout port alias name variations. Special-case master port references in log messages. |
3535
| 0.6 | 08/12/2020 | Greg Paussa | Use STATE_DB update to indicate DPB change instead of CONFIG_DB. |
3636
| 0.7 | 08/24/2020 | Greg Paussa | Added disclaimer for DPB log message translations in Section 1.1. |
37+
| 0.8 | 09/03/2020 | Greg Paussa | Added a note regarding an inband log message as a faster alternative to SIGHUP for reloading tables. Added Section 3.6.5 describing system resource usage. |
3738

3839
# About this Manual
3940

@@ -78,6 +79,9 @@ A high-level view of the operation:
7879

7980
5. The localhost rsyslogd is not state-aware of any context from which a syslog message is originated.
8081

82+
### A Note About SIGHUP Usage
83+
84+
This document mentions using the SIGHUP signal to notify the rsyslogd process to reload its translation tables from files. While this works and is a valid way to reload the tables, experimentation has shown that there is a quicker way to do this by sending a special log message to rsyslog that is detected by an rsyslog configuration rule and calls reload_lookup_table() as its action. This special inband log message can be discarded. From a design perspective these two techniques are equivalent, however the implementation can use either one.
8185

8286
## 1.1 Requirements
8387

@@ -251,7 +255,7 @@ $IncludeConfig /etc/rsyslog-intf-name.conf
251255
- See /etc/rsyslog.d/01-sonic-broadcom.conf for details.
252256

253257
11. The **/etc/rsyslog-intf-name.conf** file shall instantiate the rsyslog lookup table and the new alias translation action.
254-
- Enable the lookup table to be reloaded from its .json file on a SIGHUP signal.
258+
- Enable the lookup table to be reloaded from its .json file automatically on a SIGHUP signal (if desired).
255259
- Handle translating up to two native interface names in the same syslog message.
256260
- Allow an exemption for all messages at or below (lower severity than) a specified severity level.
257261
- Allow an exemption list of an entire category of message originators, as defined by the syslog message tag field (specifically, $programname).
@@ -275,10 +279,10 @@ $IncludeConfig /etc/rsyslog-intf-name.conf
275279
- A change in the interface-naming mode *does* require restarting the rsyslog service.
276280
- This is a rather significant, yet infrequent, config event in the system.
277281
- It allows the /etc/rsyslog.conf file to be rewritten to add/remove the lookup table operation.
278-
- A change in DPB configuration only requires issuing a SIGHUP signal to the rsyslog process to force a reload of the lookup table (when in use).
282+
- A change in DPB configuration only requires that the rsyslog process reload its lookup table (SIGHUP signal or special inband log message) when in use.
279283
- The rsyslog process remains operational and is not restarted.
280284
- Much faster: approximately 0.5 msec for SIGHUP vs. 30 msec for rsyslog service restart.
281-
- The implementation can trigger the SIGHUP as soon as DPB signals via the STATE_DB that the current breakout transaction has reached a certain point, which is after the old ports have been deleted, but before the new ports are created.
285+
- The implementation can initiate the lookup table rebuild and reload as soon as DPB signals via the STATE_DB that the current breakout transaction has reached a certain point, which is after the old ports have been deleted, but before the new ports are created.
282286
- The subsequent translation table update can proceed, since it does not rely on any CONFIG_DB PORT table updates, which may occur asynchronously.
283287

284288

@@ -317,15 +321,15 @@ The rsyslog service running in the switch host environment is where the interfac
317321
- Then continues running as a daemon, subscribing to relevant CONFIG_DB and STATE_DB changes.
318322
- Once the new rsyslog JSON files are created, the rsyslog-config.py script either:
319323
- (Re)generates the rsyslog.conf file and restarts the rsyslog service, or
320-
- Reloads just the mapping table from the rsyslog_port_aliases.json file via a SIGHUP signal.
321-
- For example:
324+
- Reloads just the mapping table from the rsyslog_port_aliases.json file via a SIGHUP signal or special inband log message.
325+
- For example, using SIGHUP:
322326
```
323327
--- restart rsyslog service ---
324328
sonic-cfggen -d -t /usr/share/sonic/templates/rsyslog.conf.j2 >/etc/rsyslog.conf
325329
systemctl restart rsyslog
326330
327331
--- reload mapping tables ---
328-
kill -HUP `ps -eo pid,stat,cmd | grep "rsyslog" | grep "Ssl" | aux '{ print $1 }'`
332+
systemctl kill -s HUP rsyslog
329333
```
330334

331335
2. The /etc/rsyslog.conf file is dynamically generated from a jinja2 template using elements from the CONFIG_DB DEVICE_METADATA|localhost configuration.
@@ -354,7 +358,7 @@ The expectation is that a given device's platform.json file contains a single ma
354358

355359
DPB related configuration changes do *not* require a system reboot or config reload, therefore the rsyslog translation table must be updated whenever a change in port breakout mode is detected in the STATE_DB PORT_BREAKOUT table (only interested in base port DPB status changes). The current breakout mode can be read from the CONFIG_DB BREAKOUT_CFG table 'brkout_mode' attribute listed for the base port.
356360

357-
For the base ports, their standard alias name is determined by reading the first 'alias_at_lanes' entry in their platform.json definition, subject to the following modification: if the port supports breakout, but is currently not broken out, then the trailing "/<breakout_port> part of the alias name is removed. Once the new translation table JSON file is built, a SIGHUP signal is used to tell rsyslog to reload its lookup table from the JSON file without restarting the process.
361+
For the base ports, their standard alias name is determined by reading the first 'alias_at_lanes' entry in their platform.json definition, subject to the following modification: if the port supports breakout, but is currently not broken out, then the trailing "/<breakout_port> part of the alias name is removed. Once the new translation table JSON file is built, rsyslog is told to reload its lookup table from the JSON file (SIGHUP or special inband log message) without restarting the process.
358362

359363

360364
### 1.2.1.2 Systemd Journal Remains Untranslated
@@ -398,7 +402,6 @@ Platforms that support standard interface naming mode.
398402

399403

400404

401-
402405
**TBD
403406

404407

@@ -526,12 +529,28 @@ The rsyslog service in the localhost Debian environment is where interface name
526529
- config reload
527530
- interface naming mode config change
528531

529-
The rsyslog service will simply reload its translation table upon receipt of a SIGHUP signal for the following:
532+
The rsyslog service will simply reload its translation table (SIGHUP signal or special inband log message) for the following:
530533

531534
- DPB config change
532535

533536
The rsyslog-config service creates the rsyslog configuration prior to (re)starting the rsyslog service. It is restarted during cold boot, warm boot, and config reload along with the rest of the system. The rsyslog-config service runs as a daemon process in the localhost environment.
534537

538+
### 3.6.5 Resource Usage
539+
540+
Interface name translation by the rsyslog service requires some translation tables and additional rules in the rsyslog.conf configuration. Although exact numbers can vary, the following incremental resource usage was observed with ```top``` on a vSONIC VS device while running in standard naming mode as compared to native mode:
541+
542+
- CPU Utilization: +1% (approximately)
543+
- Memory: +80 MB
544+
545+
The CPU utilization was measured while sending 10000 logger messages from the swss Docker (approximately 435 messages per second on this setup).
546+
547+
In addition, the rsyslog-config service is now a daemon process that consumes the following system resources:
548+
549+
- CPU Utilization: 0%
550+
- Memory: 56 MB
551+
552+
The rsyslog-config daemon metrics are not affected by the current interface-naming mode.
553+
535554
# 4 Flow Diagrams
536555

537556
**TBD

0 commit comments

Comments
 (0)