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

*: support write slow query log into seperate files #4804

Merged
merged 6 commits into from
Oct 20, 2017

Conversation

tiancaiamao
Copy link
Contributor

Support this config option, then slow query log will be redirect to the separate files:

[log]
slow-query-file = "slow-query.log"

This PR also remove pd/pkg/logutil and create a tidb/util/logutil package, because log config in Pd is somehow different with TiDB. For example, TiDB doesn't need to handle etcd log, while Pd doesn't need to collect slow query log.

Using slow_query_log and slow_query_log_file SQL variable to control the slow query log is not supported deliberately, because global session variable will change all TiDB instance's behavior, the deploy environment of the instances maybe diverse, however.

@shenli
Copy link
Member

shenli commented Oct 17, 2017

Please fix CI.

@@ -37,6 +37,9 @@ format = "text"
# Disable automatic timestamps in output
disable-timestamp = false

# Stores slow query log into seperate files.
#slow-query-file = ""
Copy link
Contributor

Choose a reason for hiding this comment

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

Remove #?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We should not set it by default, merge the output of slow query to standard log will be helpful for debugging.

@zimulala
Copy link
Contributor

Add a unit test for SlowQueryLogger ?

Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

Why you move the logutil/log.go from vendor/pd to TiDB, not just copy the file?

@tiancaiamao
Copy link
Contributor Author

This PR also remove pd/pkg/logutil and create a tidb/util/logutil package, because log config in Pd is somehow different with TiDB. For example, TiDB doesn't need to handle etcd log, while Pd doesn't need to collect slow query log.

@winkyao

@coocood
Copy link
Member

coocood commented Oct 20, 2017

LGTM

@coocood coocood added the status/LGT1 Indicates that a PR has LGTM 1. label Oct 20, 2017
Copy link
Contributor

@winkyao winkyao left a comment

Choose a reason for hiding this comment

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

LGTM

@jackysp jackysp merged commit 7afae3f into master Oct 20, 2017
@jackysp jackysp deleted the tiancaiamao/slow-log branch October 20, 2017 06:22
tiancaiamao added a commit to tiancaiamao/tidb that referenced this pull request Oct 22, 2017
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status/LGT1 Indicates that a PR has LGTM 1.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants