Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Klibs: syslog improvements #1674

Merged
merged 2 commits into from
Feb 9, 2022
Merged

Klibs: syslog improvements #1674

merged 2 commits into from
Feb 9, 2022

Conversation

francescolavra
Copy link
Member

This PR contains miscellaneous improvements to the syslog klib:

  • in case of failure to resolve the syslog server name, the backoff delay for retrying DNS resolution is limited to 1 minute, to prevent long delays before logs start to be shipped after a previously unresolvable server becomes resolvable
  • the dns_gethostbyname() function is now called before sending syslog packets, even after the server name has been
    successfully resolved, so that when the cached DNS entry expires a new DNS request will be sent and any changes to the server IP address will be observed
  • if the IMAGE_NAME environment variable is present, it is used to populate the APP_NAME field in syslog messages, while
    the program name is used as a fallback

francescolavra added a commit to nanovms/ops that referenced this pull request Feb 2, 2022
This can be used by Nanos to identify the image where it is running
(see e.g. nanovms/nanos#1674).
Copy link
Collaborator

@sanderssj sanderssj left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link
Contributor

@wjhun wjhun left a comment

Choose a reason for hiding this comment

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

LGTM

In case of failure to resolve the syslog server name, using a pure
exponential backoff delay for retrying DNS resolution can cause
logs to be shipped long after a previousy unresolvable server
became resolvable. This commit puts a 1-minute limit to the backoff
delay.
The current code stops resolving the syslog server name after a
successful resolution, and this can cause issues if the server IP
address changes. To solve this problem, the dns_gethostbyname()
function is now called even after the server name has been
successfully resolved, so that when the cached DNS entry expires a
new DNS request will be sent.
With this change, if the IMAGE_NAME environment variable is present
it is used to populate the APP_NAME field in syslog messages, while
the program name is used as a fallback.
@francescolavra francescolavra merged commit b7a4741 into master Feb 9, 2022
@francescolavra francescolavra deleted the feature/syslog branch February 9, 2022 08:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants