Skip to content

[arp_update]: Use parent script PID for logger calls#19219

Merged
kperumalbfn merged 1 commit intosonic-net:masterfrom
theasianpianist:arp-update-log-pid
Jun 8, 2024
Merged

[arp_update]: Use parent script PID for logger calls#19219
kperumalbfn merged 1 commit intosonic-net:masterfrom
theasianpianist:arp-update-log-pid

Conversation

@theasianpianist
Copy link
Copy Markdown
Contributor

@theasianpianist theasianpianist commented Jun 6, 2024

Why I did it

When a script calls the logger utility, each individual call gets its own PID assigned. Rsyslogd creates an internal rate-limit object per PID that sends a log message. If the logger utility is called repeatedly, it will cause rsyslogd memory usage to increase permanently since a rate-limit object is being created for each call.

Work item tracking
  • Microsoft ADO 28263484:

How I did it

Override the logger command in the arp_update script to use the --id argument to specify the parent script PID that rsyslogd should use for rate limiting.

How to verify it

Which release branch to backport (provide reason below if selected)

  • 201811
  • 201911
  • 202006
  • 202012
  • 202106
  • 202111
  • 202205
  • 202211
  • 202305

Tested branch (Please provide the tested image version)

Description for the changelog

Link to config_db schema for YANG module changes

A picture of a cute animal (not mandatory but encouraged)

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Jun 6, 2024

Could you please update description and whats the behavior before and after this change?

@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Jun 8, 2024

@kperumalbfn , can you please review/merge?

Copy link
Copy Markdown
Contributor

@kperumalbfn kperumalbfn left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@kperumalbfn kperumalbfn merged commit ff77018 into sonic-net:master Jun 8, 2024
@prsunny
Copy link
Copy Markdown
Contributor

prsunny commented Jun 9, 2024

@theasianpianist , can you confirm it is tested for the following scenarios and logging works as expected?

  1. restart arp_update script
  2. restart rsyslogd

mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Jun 10, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202305: #19258

mssonicbld pushed a commit that referenced this pull request Jun 10, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
@theasianpianist
Copy link
Copy Markdown
Contributor Author

@theasianpianist , can you confirm it is tested for the following scenarios and logging works as expected?

  1. restart arp_update script
  2. restart rsyslogd

Co firmed, logging works as expected here

mssonicbld pushed a commit to mssonicbld/sonic-buildimage that referenced this pull request Jun 12, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
@mssonicbld
Copy link
Copy Markdown
Collaborator

Cherry-pick PR to 202405: #19292

mssonicbld pushed a commit that referenced this pull request Jun 15, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
MuLinForest pushed a commit to MuLinForest/sonic-buildimage that referenced this pull request Aug 6, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
MuLinForest pushed a commit to MuLinForest/sonic-buildimage that referenced this pull request Aug 6, 2024
theasianpianist added a commit to theasianpianist/sonic-buildimage that referenced this pull request Aug 28, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
yxieca pushed a commit that referenced this pull request Aug 28, 2024
[arp_update]: Use parent script PID for logger calls

Signed-off-by: Lawrence Lee <lawlee@microsoft.com>
# Overload `logger` command to include arp_update tag
logger () {
command logger -t "arp_update" "$@"
command logger -i "$$" -t "arp_update" "$@"
Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
command logger -i "$$" -t "arp_update" "$@"
command logger --id="$$" -t "arp_update" "$@"

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants