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

feat: Enable to save slowlog in logfile #2823

Open
wants to merge 6 commits into
base: unstable
Choose a base branch
from

Conversation

greatsharp
Copy link

No description provided.

@greatsharp greatsharp changed the title Enable to save slowlog in logfile feat: Enable to save slowlog in logfile Mar 8, 2025
@aleksraiden
Copy link
Contributor

It's a good idea, thanks!

Comment on lines 121 to 124
// json format
auto log = fmt::format("[slowlog] {{\"id\":{}, \"timestamp\":{}, \"duration\":{}, \"cmd\":\"{}\", "
"\"ip\":\"{}\", \"port\":{}, \"client_name\":\"{}\"}}",
entry->id, entry->time, entry->duration, cmd, entry->ip, entry->port, entry->client_name);
Copy link
Member

Choose a reason for hiding this comment

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

Hmm in other places we don't use JSON format in logs, so maybe we should consider if we want to use JSON format in log here.

Copy link
Author

Choose a reason for hiding this comment

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

  1. just want to show slowlog integrally in log file, distinguish with other runtime logs.
    Snipaste_2025-03-09_10-13-27

  2. if third-party software wants to gather slowlog from log file, json format maybe more friendlly.

Copy link
Contributor

Choose a reason for hiding this comment

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

@greatsharp I think it's already distinguished since the lines have the [slowlog] prefix. What @PragmaTwice might suggested was to introduce one more option to specify the slow log format (for example, "text" (default) or "json"). WDYT, @PragmaTwice ?

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.

4 participants