Skip to content

Commit c3fe1a5

Browse files
added 'all' as log mode and updated the help text
Signed-off-by: Harshit Gangal <harshit@planetscale.com>
1 parent 5e0a52f commit c3fe1a5

File tree

4 files changed

+19
-14
lines changed

4 files changed

+19
-14
lines changed

go/flags/endtoend/vtcombo.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,7 @@ Flags:
272272
--querylog-buffer-size int Maximum number of buffered query logs before throttling log output (default 10)
273273
--querylog-filter-tag string string that must be present in the query for it to be logged; if using a value as the tag, you need to disable query normalization
274274
--querylog-format string format for query logs ("text" or "json") (default "text")
275-
--querylog-mode string Mode for logging queries. 'error' will only log queries that return an error. Otherwise all queries will be logged.
275+
--querylog-mode string Mode for logging queries. "error" will only log queries that return an error. Otherwise all queries will be logged. (default "all")
276276
--querylog-row-threshold uint Number of rows a query has to return or affect before being logged; not useful for streaming queries. 0 means all queries will be logged.
277277
--querylog-sample-rate float Sample rate for logging queries. Value must be between 0.0 (no logging) and 1.0 (all queries)
278278
--queryserver-config-acl-exempt-acl string an acl that exempt from table acl checking (this acl is free to access any vitess tables).

go/flags/endtoend/vtgate.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -177,7 +177,7 @@ Flags:
177177
--querylog-buffer-size int Maximum number of buffered query logs before throttling log output (default 10)
178178
--querylog-filter-tag string string that must be present in the query for it to be logged; if using a value as the tag, you need to disable query normalization
179179
--querylog-format string format for query logs ("text" or "json") (default "text")
180-
--querylog-mode string Mode for logging queries. 'error' will only log queries that return an error. Otherwise all queries will be logged.
180+
--querylog-mode string Mode for logging queries. "error" will only log queries that return an error. Otherwise all queries will be logged. (default "all")
181181
--querylog-row-threshold uint Number of rows a query has to return or affect before being logged; not useful for streaming queries. 0 means all queries will be logged.
182182
--querylog-sample-rate float Sample rate for logging queries. Value must be between 0.0 (no logging) and 1.0 (all queries)
183183
--redact-debug-ui-queries redact full queries and bind variables from debug UI

go/flags/endtoend/vttablet.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -264,7 +264,7 @@ Flags:
264264
--query-log-stream-handler string URL handler for streaming queries log (default "/debug/querylog")
265265
--querylog-filter-tag string string that must be present in the query for it to be logged; if using a value as the tag, you need to disable query normalization
266266
--querylog-format string format for query logs ("text" or "json") (default "text")
267-
--querylog-mode string Mode for logging queries. 'error' will only log queries that return an error. Otherwise all queries will be logged.
267+
--querylog-mode string Mode for logging queries. "error" will only log queries that return an error. Otherwise all queries will be logged. (default "all")
268268
--querylog-row-threshold uint Number of rows a query has to return or affect before being logged; not useful for streaming queries. 0 means all queries will be logged.
269269
--querylog-sample-rate float Sample rate for logging queries. Value must be between 0.0 (no logging) and 1.0 (all queries)
270270
--queryserver-config-acl-exempt-acl string an acl that exempt from table acl checking (this acl is free to access any vitess tables).

go/streamlog/streamlog.go

Lines changed: 16 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,19 @@ var (
4747
[]string{"Log", "Subscriber"})
4848
)
4949

50-
const QueryLogModeError = "error"
50+
const (
51+
// QueryLogFormatText is the format specifier for text querylog output
52+
QueryLogFormatText = "text"
53+
54+
// QueryLogFormatJSON is the format specifier for json querylog output
55+
QueryLogFormatJSON = "json"
56+
57+
// QueryLogModeAll is the mode specifier for logging all queries
58+
QueryLogModeAll = "all"
59+
60+
// QueryLogModeError is the mode specifier for logging only queries that return an error
61+
QueryLogModeError = "error"
62+
)
5163

5264
type QueryLogConfig struct {
5365
RedactDebugUIQueries bool
@@ -59,7 +71,8 @@ type QueryLogConfig struct {
5971
}
6072

6173
var queryLogConfigInstance = QueryLogConfig{
62-
Format: "text",
74+
Format: QueryLogFormatText,
75+
Mode: QueryLogModeAll,
6376
}
6477

6578
func GetQueryLogConfig() QueryLogConfig {
@@ -95,17 +108,9 @@ func registerStreamLogFlags(fs *pflag.FlagSet) {
95108
fs.Float64Var(&queryLogConfigInstance.sampleRate, "querylog-sample-rate", queryLogConfigInstance.sampleRate, "Sample rate for logging queries. Value must be between 0.0 (no logging) and 1.0 (all queries)")
96109

97110
// QueryLogMode controls the mode for logging queries (all or error)
98-
fs.StringVar(&queryLogConfigInstance.Mode, "querylog-mode", queryLogConfigInstance.Mode, `Mode for logging queries. 'error' will only log queries that return an error. Otherwise all queries will be logged.`)
111+
fs.StringVar(&queryLogConfigInstance.Mode, "querylog-mode", queryLogConfigInstance.Mode, `Mode for logging queries. "error" will only log queries that return an error. Otherwise all queries will be logged.`)
99112
}
100113

101-
const (
102-
// QueryLogFormatText is the format specifier for text querylog output
103-
QueryLogFormatText = "text"
104-
105-
// QueryLogFormatJSON is the format specifier for json querylog output
106-
QueryLogFormatJSON = "json"
107-
)
108-
109114
// StreamLogger is a non-blocking broadcaster of messages.
110115
// Subscribers can use channels or HTTP.
111116
type StreamLogger[T any] struct {

0 commit comments

Comments
 (0)