Skip to content

[Microsoft SQLServer] Add support for list of Dynamic Counter values #14153

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions packages/microsoft_sqlserver/_dev/build/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

The Microsoft SQL Server integration package allows you to search, observe, and visualize the SQL Server audit logs, as well as performance and transaction log metrics, through Elasticsearch.

## ⚠️ Important Note: Upgrading from version 2.12.0 to 3.0.0
When upgrading from version 2.12.0 to 3.0.0, you must manually modify the dynamic counter configuration for performance metrics data stream. Follow these steps:
1. Before upgrading, note your current `Dynamic Counter Name` values
2. Remove the default value from the `Dynamic Counter Name` configurations by editing the integration policy
3. Click `Save integration`
4. Upgrade the integration version to version 3.0.0
5. After the upgrade, re-add your desired counter configurations using the new multi-value input

This is necessary due to changes in how dynamic counters are handled in the new version.

## Data streams

The Microsoft SQL Server integration collects two types of data streams: logs and metrics.
Expand Down Expand Up @@ -110,9 +120,14 @@ Read more in [View the SQL Server error log in SQL Server Management Studio](htt

#### Performance metrics

Collects the `performance` counter metrics. The dynamic counter feature provides flexibility to collect metrics by providing the counter as an input.
This input can be a regular expression which will filter results based on pattern.
For example, if %grant% is given as input, it will enable metrics collection for all of the counters with names like 'Memory Grants Pending', 'Active memory grants count' etc.
Collects the `performance` counter metrics. The dynamic counter feature provides flexibility to collect metrics by specifying one or more counter patterns.

You can add multiple counter patterns using the "Add more" button in the UI. Each pattern can be:
- A specific counter name with wildcard (e.g., 'Buffer cache hit ratio%')
- A regular expression pattern to match multiple counters (e.g., '%grant%' will match 'Memory Grants Pending', 'Active memory grants count', etc.)

By default, the integration collects metrics for the 'Memory Grants Pend%' pattern.

MSSQL supports a limited set of regular expressions. For more details, refer to [Pattern Matching in Search Conditions](https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms187489(v=sql.105)?redirectedfrom=MSDN).

> Note: Dynamic counters will go through some basic ingest pipeline post-processing to make counter names in lowercase and remove special characters and these fields will not have any static field mappings.
Expand Down
5 changes: 5 additions & 0 deletions packages/microsoft_sqlserver/changelog.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,9 @@
# newer versions go on top
- version: "3.0.0"
changes:
- description: Add support for list of Dynamic Counters
type: enhancement
link: https://github.com/elastic/integrations/pull/14153
- version: "2.12.0"
changes:
- description: Add support for Kibana `9.0.0`.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ sql_queries:
response_format: table
- query: "SELECT cntr_value As 're_compilations_per_sec' FROM sys.dm_os_performance_counters WHERE counter_name = 'SQL Re-Compilations/sec'"
response_format: table
- query: "SELECT counter_name, cntr_value FROM sys.dm_os_performance_counters WHERE counter_name like '{{dynamic_counter_name}}'"
{{#if dynamic_counter_name}}
{{#each dynamic_counter_name as | dynamic_counter i|}}
Copy link
Member

Choose a reason for hiding this comment

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

Do we intend to use "i" anywhere, else remove it.

- query: "SELECT counter_name, cntr_value FROM sys.dm_os_performance_counters WHERE counter_name like '{{dynamic_counter}}'"
response_format: variables
{{/each}}
{{/if}}
{{#if processors}}
processors:
{{processors}}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,11 @@ streams:
- name: dynamic_counter_name
type: text
title: Dynamic Counter Name
multi: false
multi: true
required: false
show_user: true
default: 'Memory Grants Pend%'
default:
- 'Memory Grants Pend%'
description: Collect the values for dynamic counters based on the provided pattern from the performance table.
- name: preserve_sql_queries
required: true
Expand Down
21 changes: 18 additions & 3 deletions packages/microsoft_sqlserver/docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,16 @@

The Microsoft SQL Server integration package allows you to search, observe, and visualize the SQL Server audit logs, as well as performance and transaction log metrics, through Elasticsearch.

## ⚠️ Important Note: Upgrading from version 2.12.0 to 3.0.0
When upgrading from version 2.12.0 to 3.0.0, you must manually modify the dynamic counter configuration for performance metrics data stream. Follow these steps:
1. Before upgrading, note your current `Dynamic Counter Name` values
2. Remove the default value from the `Dynamic Counter Name` configurations by editing the integration policy
3. Click `Save integration`
4. Upgrade the integration version to version 3.0.0
5. After the upgrade, re-add your desired counter configurations using the new multi-value input

This is necessary due to changes in how dynamic counters are handled in the new version.

## Data streams

The Microsoft SQL Server integration collects two types of data streams: logs and metrics.
Expand Down Expand Up @@ -110,9 +120,14 @@ Read more in [View the SQL Server error log in SQL Server Management Studio](htt

#### Performance metrics

Collects the `performance` counter metrics. The dynamic counter feature provides flexibility to collect metrics by providing the counter as an input.
This input can be a regular expression which will filter results based on pattern.
For example, if %grant% is given as input, it will enable metrics collection for all of the counters with names like 'Memory Grants Pending', 'Active memory grants count' etc.
Collects the `performance` counter metrics. The dynamic counter feature provides flexibility to collect metrics by specifying one or more counter patterns.

You can add multiple counter patterns using the "Add more" button in the UI. Each pattern can be:
- A specific counter name with wildcard (e.g., 'Buffer cache hit ratio%')
- A regular expression pattern to match multiple counters (e.g., '%grant%' will match 'Memory Grants Pending', 'Active memory grants count', etc.)

By default, the integration collects metrics for the 'Memory Grants Pend%' pattern.

MSSQL supports a limited set of regular expressions. For more details, refer to [Pattern Matching in Search Conditions](https://learn.microsoft.com/en-us/previous-versions/sql/sql-server-2008-r2/ms187489(v=sql.105)?redirectedfrom=MSDN).

> Note: Dynamic counters will go through some basic ingest pipeline post-processing to make counter names in lowercase and remove special characters and these fields will not have any static field mappings.
Expand Down
2 changes: 1 addition & 1 deletion packages/microsoft_sqlserver/manifest.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
format_version: "3.0.2"
name: microsoft_sqlserver
title: "Microsoft SQL Server"
version: "2.12.0"
version: "3.0.0"
description: Collect events from Microsoft SQL Server with Elastic Agent
type: integration
categories:
Expand Down