diff --git a/CHANGELOG.next.asciidoc b/CHANGELOG.next.asciidoc index 76f99ced0c1..b6f0c1c8e86 100644 --- a/CHANGELOG.next.asciidoc +++ b/CHANGELOG.next.asciidoc @@ -336,7 +336,7 @@ https://github.com/elastic/beats/compare/v7.0.0-alpha2...master[Check the HEAD d - Add final tests and move label to GA for the azure module in metricbeat. {pull}17319[17319] - Reference kubernetes manifests mount data directory from the host when running metricbeat as daemonset, so data persist between executions in the same node. {pull}17429[17429] - Stack Monitoring modules now auto-configure required metricsets when `xpack.enabled: true` is set. {issue}16471[[16471] {pull}17609[17609] -- Update MSSQL module to fix some SSPI authentication {pull}17862[17862]] +- Update MSSQL module to fix some SSPI authentication and add brackets to USE statements {pull}17862[17862]] *Packetbeat* diff --git a/x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go b/x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go index 9342dcc217b..a974ffdab9b 100644 --- a/x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go +++ b/x-pack/metricbeat/module/mssql/transaction_log/transaction_log.go @@ -124,7 +124,7 @@ func (m *MetricSet) Close() error { func (m *MetricSet) getLogSpaceUsageForDb(dbName string) (common.MapStr, error) { // According to MS docs a single result is always returned for this query - row := m.db.QueryRow(fmt.Sprintf(`USE %s; SELECT * FROM sys.dm_db_log_space_usage;`, dbName)) + row := m.db.QueryRow(fmt.Sprintf(`USE [%s]; SELECT * FROM sys.dm_db_log_space_usage;`, dbName)) var res logSpace if err := row.Scan(&res.id, &res.totalLogSizeInBytes, &res.usedLogSpaceInBytes, &res.usedLogSpaceInPercent, @@ -150,7 +150,7 @@ func (m *MetricSet) getLogSpaceUsageForDb(dbName string) (common.MapStr, error) } func (m *MetricSet) getLogStats(db dbInfo) (common.MapStr, error) { // According to MS docs a single result is always returned for this query - row := m.db.QueryRow(fmt.Sprintf(`USE %s; SELECT database_id,total_log_size_mb,active_log_size_mb,log_backup_time,log_since_last_log_backup_mb,log_since_last_checkpoint_mb,log_recovery_size_mb FROM sys.dm_db_log_stats(%d);`, db.name, db.id)) + row := m.db.QueryRow(fmt.Sprintf(`USE [%s]; SELECT database_id,total_log_size_mb,active_log_size_mb,log_backup_time,log_since_last_log_backup_mb,log_since_last_checkpoint_mb,log_recovery_size_mb FROM sys.dm_db_log_stats(%d);`, db.name, db.id)) var res logStats if err := row.Scan(&res.databaseID, &res.sizeMB, &res.activeSizeMB, &res.backupTime, &res.sinceLastBackupMB, &res.sinceLastCheckpointMB, &res.recoverySizeMB); err != nil {