parent
6d4319d244
commit
7b1a4e6700
|
@ -116,6 +116,7 @@ func NewServer(c *Config, buildInfo *BuildInfo) (*Server, error) {
|
|||
s.QueryExecutor.MetaStatementExecutor = &meta.StatementExecutor{Store: s.MetaStore}
|
||||
s.QueryExecutor.MonitorStatementExecutor = &monitor.StatementExecutor{Monitor: s.Monitor}
|
||||
s.QueryExecutor.ShardMapper = s.ShardMapper
|
||||
s.QueryExecutor.QueryLogEnabled = c.Data.QueryLogEnabled
|
||||
|
||||
// Set the shard writer
|
||||
s.ShardWriter = cluster.NewShardWriter(time.Duration(c.Cluster.ShardWriterTimeout))
|
||||
|
|
|
@ -67,6 +67,10 @@ reporting-disabled = false
|
|||
# The more memory you have, the bigger this can be.
|
||||
# wal-partition-size-threshold = 20971520
|
||||
|
||||
# Whether queries should be logged before execution. Very useful for troubleshooting, but will
|
||||
# log any sensitive data contained within a query.
|
||||
query-log-enabled = true
|
||||
|
||||
###
|
||||
### [cluster]
|
||||
###
|
||||
|
|
|
@ -58,6 +58,9 @@ type Config struct {
|
|||
WALMaxSeriesSize int `toml:"wal-max-series-size"`
|
||||
WALFlushColdInterval toml.Duration `toml:"wal-flush-cold-interval"`
|
||||
WALPartitionSizeThreshold uint64 `toml:"wal-partition-size-threshold"`
|
||||
|
||||
// Query logging
|
||||
QueryLogEnabled bool `toml:"query-log-enabled"`
|
||||
}
|
||||
|
||||
func NewConfig() Config {
|
||||
|
@ -72,5 +75,7 @@ func NewConfig() Config {
|
|||
WALMaxSeriesSize: DefaultMaxSeriesSize,
|
||||
WALFlushColdInterval: toml.Duration(DefaultFlushColdInterval),
|
||||
WALPartitionSizeThreshold: DefaultPartitionSizeThreshold,
|
||||
|
||||
QueryLogEnabled: true,
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,7 +45,8 @@ type QueryExecutor struct {
|
|||
CreateMapper(shard meta.ShardInfo, stmt influxql.Statement, chunkSize int) (Mapper, error)
|
||||
}
|
||||
|
||||
Logger *log.Logger
|
||||
Logger *log.Logger
|
||||
QueryLogEnabled bool
|
||||
|
||||
// the local data store
|
||||
Store *Store
|
||||
|
@ -150,7 +151,9 @@ func (q *QueryExecutor) ExecuteQuery(query *influxql.Query, database string, chu
|
|||
}
|
||||
|
||||
// Log each normalized statement.
|
||||
q.Logger.Println(stmt.String())
|
||||
if q.QueryLogEnabled {
|
||||
q.Logger.Println(stmt.String())
|
||||
}
|
||||
|
||||
var res *influxql.Result
|
||||
switch stmt := stmt.(type) {
|
||||
|
|
Loading…
Reference in New Issue