diff options
author | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:20 +0000 |
---|---|---|
committer | Daniel Baumann <daniel.baumann@progress-linux.org> | 2024-08-26 08:15:20 +0000 |
commit | 87d772a7d708fec12f48cd8adc0dedff6e1025da (patch) | |
tree | 1fee344c64cc3f43074a01981e21126c8482a522 /src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go | |
parent | Adding upstream version 1.46.3. (diff) | |
download | netdata-87d772a7d708fec12f48cd8adc0dedff6e1025da.tar.xz netdata-87d772a7d708fec12f48cd8adc0dedff6e1025da.zip |
Adding upstream version 1.47.0.upstream/1.47.0
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go')
-rw-r--r-- | src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go | 58 |
1 files changed, 0 insertions, 58 deletions
diff --git a/src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go b/src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go deleted file mode 100644 index 3a2eea6a1..000000000 --- a/src/go/collectors/go.d.plugin/modules/mysql/disable_logging.go +++ /dev/null @@ -1,58 +0,0 @@ -// SPDX-License-Identifier: GPL-3.0-or-later - -package mysql - -const ( - queryShowSessionVariables = ` -SHOW SESSION VARIABLES -WHERE - Variable_name LIKE 'sql_log_off' - OR Variable_name LIKE 'slow_query_log';` -) - -const ( - queryDisableSessionQueryLog = "SET SESSION sql_log_off='ON';" - queryDisableSessionSlowQueryLog = "SET SESSION slow_query_log='OFF';" -) - -func (m *MySQL) disableSessionQueryLog() { - q := queryShowSessionVariables - m.Debugf("executing query: '%s'", q) - - var sqlLogOff, slowQueryLog string - var name string - _, err := m.collectQuery(q, func(column, value string, _ bool) { - switch column { - case "Variable_name": - name = value - case "Value": - switch name { - case "sql_log_off": - sqlLogOff = value - case "slow_query_log": - slowQueryLog = value - } - } - }) - if err != nil { - m.Debug(err) - return - } - - if sqlLogOff == "OFF" && m.doDisableSessionQueryLog { - // requires SUPER privileges - q = queryDisableSessionQueryLog - m.Debugf("executing query: '%s'", q) - if _, err := m.collectQuery(q, func(_, _ string, _ bool) {}); err != nil { - m.Infof("failed to disable session query log (sql_log_off): %v", err) - m.doDisableSessionQueryLog = false - } - } - if slowQueryLog == "ON" { - q = queryDisableSessionSlowQueryLog - m.Debugf("executing query: '%s'", q) - if _, err := m.collectQuery(q, func(_, _ string, _ bool) {}); err != nil { - m.Debugf("failed to disable session slow query log (slow_query_log): %v", err) - } - } -} |