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

Option to configure UPTIME_KUMA_LOG_FORMAT: json or text #5107

Closed
1 task done
fsteinke opened this issue Sep 13, 2024 · 3 comments Β· Fixed by #5118
Closed
1 task done

Option to configure UPTIME_KUMA_LOG_FORMAT: json or text #5107

fsteinke opened this issue Sep 13, 2024 · 3 comments Β· Fixed by #5118
Labels
feature-request Request for new features to be added

Comments

@fsteinke
Copy link

πŸ“‘ I have found these related issues/pull requests

  • Checked and didn't find similar issue

🏷️ Feature Request Type

Settings

πŸ”– Feature description

It would be very helpful for us to have an ENV_VAR to configure the logging format directly.
To be clear, a general option to switch between the current "text" logs and logs in "json" would already be a great benefit.

βœ”οΈ Solution

Extend Logger implementation with a e.g. UPTIME_KUMA_LOG_FORMAT variable that can be set to "text" or "json" with "text" being the default, similar to the implementation of UPTIME_KUMA_HIDE_LOG.

Instead of logging to console as

console.error(timePart, modulePart, levelPart, msgPart);

with the value set to "json" the logging could log like this:

console.error(
  JSON.stringify(
    "timestamp": timePart,
    "module": modulePart,
    "level": levelPart,
    "message": msgPart
  )
);

❓ Alternatives

We have considered that this functionality would be possible by a log management solution, but a direct choice and configuration of the logFormat seems to us like a quick and valuable option to avoid further transformations in upstream solutions for the logs produced by kuma.

πŸ“ Additional Context

n/a

@fsteinke fsteinke added the feature-request Request for new features to be added label Sep 13, 2024
@CommanderStorm
Copy link
Collaborator

Shure, reasonable.
Doing this needs the following PRs to work fully:

If you want to provide a PR to have json as an alternative log output, our contribution guide is here: https://github.com/louislam/uptime-kuma/blob/dd75890364fe9cbdfbef6119da6c126234fa6044/CONTRIBUTING.md

@CommanderStorm CommanderStorm changed the title Option to configure loggingFormat: json or text Option to configure UPTIME_KUMA_LOG_FORMAT: json or text Sep 14, 2024
SapphicCode added a commit to SapphicCode/fork-uptime-kuma that referenced this issue Sep 19, 2024
Includes a slight refactor in the console logging section, to achieve an unformatted output and reduce complexity.

Resolves: louislam#5107
SapphicCode added a commit to SapphicCode/fork-uptime-kuma that referenced this issue Sep 19, 2024
Includes a slight refactor in the console logging section, to achieve an unformatted output and reduce complexity.

Resolves: louislam#5107
SapphicCode added a commit to SapphicCode/fork-uptime-kuma that referenced this issue Sep 19, 2024
Includes a slight refactor in the console logging section, to achieve an unformatted output and reduce complexity.

Resolves: louislam#5107
@fsteinke
Copy link
Author

@CommanderStorm is there something else, that can be done here to support or is there a chance to get #5118 reviewed, merged and release in the next days? πŸ˜‰

@CommanderStorm
Copy link
Collaborator

CommanderStorm commented Sep 23, 2024

Released is a bit of a taller task.
The concrete reasons are listed in #4500.
Currently, the 2.0.0-beta.0 release is blocked by:

If you want to help, going through the PRs and writing a changelog would be appreciated, but that is a lot of work.

SapphicCode added a commit to SapphicCode/fork-uptime-kuma that referenced this issue Oct 9, 2024
Includes a slight refactor in the console logging section, to achieve an unformatted output and reduce complexity.

Resolves: louislam#5107
SapphicCode added a commit to SapphicCode/fork-uptime-kuma that referenced this issue Oct 10, 2024
Includes a slight refactor in the console logging section, to achieve an unformatted output and reduce complexity.

Resolves: louislam#5107
SapphicCode added a commit to SapphicCode/fork-uptime-kuma that referenced this issue Oct 10, 2024
Includes a slight refactor in the console logging section, to achieve an unformatted output and reduce complexity.

Resolves: louislam#5107
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
feature-request Request for new features to be added
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants