-
Notifications
You must be signed in to change notification settings - Fork 497
[microsoft_sqlserver] Add transaction log DataStream #3395
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
Merged
muthu-mps
merged 42 commits into
elastic:main
from
muthu-mps:mssql_transaction_log_data_stream
Jun 14, 2022
Merged
Changes from all commits
Commits
Show all changes
42 commits
Select commit
Hold shift + click to select a range
6c544cf
new changes for transaction datastream
muthu-mps 1519e1d
codeowner and format changes
muthu-mps b3fa097
Naming changes for dashboard, updated img file
muthu-mps 669063c
Name changes updated
muthu-mps 9d4439e
kibana version upgraded to latest
muthu-mps bde0d4d
Updated fields and added documentation
muthu-mps 5936aef
Added Readme file
muthu-mps 655a0aa
Added Readme file
muthu-mps e8112f8
Added Readme file
muthu-mps 4367a9c
Revert "Added Readme file"
muthu-mps 5f39acc
Revert "Updated fields and added documentation"
muthu-mps d643da6
Revert "Added Readme file"
muthu-mps 8106660
Revert "Added Readme file"
muthu-mps a232927
Updated the fields and dashboard names
muthu-mps 94ed940
document update
muthu-mps 58b0be2
transaction datastream testing
muthu-mps 9002a79
Format changes and ECS version change
muthu-mps fb4ae99
doc update
muthu-mps d8b90b2
Updated the database name
muthu-mps f6a273a
Merge branch 'main' into mssql_transaction_log_data_stream
muthu-mps 1eb3f47
updated manifest and changelog entreies
muthu-mps ad28113
renamed sql to mssql & updated 60s
muthu-mps e6dea96
events updated
muthu-mps 41dad43
dashboard changes
muthu-mps adc5335
Dashboards By Value & updated mb to bytes
muthu-mps a8e67b5
Dashboards By Value & updated mb to bytes
muthu-mps 573f755
visualization by value
muthu-mps 1159a60
visualization by value
muthu-mps 2f5d7f6
updated fields
muthu-mps 271b171
added dimensions and updated ECS reference
muthu-mps f338a30
added dimensions and updated ECS reference
muthu-mps d44010c
Added reference to ECS fields & removed query, driver fields
muthu-mps 1ca96a3
formating events
muthu-mps 9e9079b
pipeline update
muthu-mps 2489810
Added co-owners
muthu-mps ab33d10
renaming to audit_log
muthu-mps 3ebbdff
removed query field
muthu-mps e9436dd
updated pipeline
muthu-mps 357e6b4
Update stream.yml.hbs
muthu-mps 3f9a2a4
Readme file updated
muthu-mps 4717288
Merge branch 'mssql_transaction_log_data_stream' of github.com:muthu-…
muthu-mps 7716acc
performance datastream conflicts resolved
muthu-mps File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
5 changes: 5 additions & 0 deletions
5
...rosoft_sqlserver/data_stream/transaction_log/_dev/test/system/test-transaction-config.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
vars: | ||
hosts: | ||
- "{{Hostname}}" | ||
username: sa | ||
password: 1234_asdf |
33 changes: 33 additions & 0 deletions
33
packages/microsoft_sqlserver/data_stream/transaction_log/agent/stream/stream.yml.hbs
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
metricsets: ["query"] | ||
# Specify hosts in the below format. TODO:hosts need to be updated to support multiple entries. | ||
hosts: | ||
- sqlserver://{{username}}:{{password}}@{{hosts}}:{{port}} | ||
period: {{period}} | ||
driver: mssql | ||
raw_data.enabled: true | ||
# Collect the transaction logs from the system database | ||
sql_queries: | ||
- query: "SELECT name As 'database_name', database_id FROM sys.databases WHERE database_id=1;" | ||
response_format: table | ||
- query: "SELECT 'master' As database_name, 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(1) master" | ||
response_format: table | ||
- query: "SELECT 'master' As 'database_name', total_log_size_in_bytes As total_log_size_bytes, used_log_space_in_bytes As used_log_space_bytes, used_log_space_in_percent As used_log_space_pct, log_space_in_bytes_since_last_backup FROM sys.dm_db_log_space_usage master" | ||
response_format: table | ||
- query: "SELECT name As 'database_name', database_id FROM sys.databases WHERE database_id=2;" | ||
response_format: table | ||
- query: "SELECT 'tempdb' As 'database_name', database_id,total_log_size_mb,active_log_size_mb As active_log_size,log_backup_time,log_since_last_log_backup_mb, log_since_last_checkpoint_mb,log_recovery_size_mb FROM sys.dm_db_log_stats(2) tempdb" | ||
response_format: table | ||
- query: "SELECT 'tempdb' As 'database_name', total_log_size_in_bytes As total_log_size_bytes, used_log_space_in_bytes As used_log_space_bytes, used_log_space_in_percent As used_log_space_pct, log_space_in_bytes_since_last_backup FROM sys.dm_db_log_space_usage tempdb" | ||
response_format: table | ||
- query: "SELECT name As 'database_name', database_id FROM sys.databases WHERE database_id=3;" | ||
response_format: table | ||
- query: "SELECT 'model' As 'database_name', database_id,total_log_size_mb,active_log_size_mb As active_log_size,log_backup_time,log_since_last_log_backup_mb, log_since_last_checkpoint_mb,log_recovery_size_mb FROM sys.dm_db_log_stats(3) model" | ||
response_format: table | ||
- query: "SELECT 'model' As 'database_name', total_log_size_in_bytes As total_log_size_bytes, used_log_space_in_bytes As used_log_space_bytes, used_log_space_in_percent As used_log_space_pct, log_space_in_bytes_since_last_backup FROM sys.dm_db_log_space_usage model" | ||
response_format: table | ||
- query: "SELECT name As 'database_name', database_id FROM sys.databases WHERE database_id=4;" | ||
response_format: table | ||
- query: "SELECT 'msdb' As 'database_name', database_id,total_log_size_mb,active_log_size_mb As active_log_size,log_backup_time,log_since_last_log_backup_mb, log_since_last_checkpoint_mb,log_recovery_size_mb FROM sys.dm_db_log_stats(4) msdb" | ||
response_format: table | ||
- query: "SELECT 'msdb' As 'database_name', total_log_size_in_bytes As total_log_size_bytes, used_log_space_in_bytes As used_log_space_bytes, used_log_space_in_percent As used_log_space_pct, log_space_in_bytes_since_last_backup FROM sys.dm_db_log_space_usage msdb" | ||
response_format: table |
75 changes: 75 additions & 0 deletions
75
...microsoft_sqlserver/data_stream/transaction_log/elasticsearch/ingest_pipeline/default.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,75 @@ | ||
--- | ||
description: Pipeline for processing mssql transaction_log | ||
processors: | ||
- remove: | ||
field: sql.driver | ||
ignore_failure: true | ||
ignore_missing: true | ||
- remove: | ||
field: sql.query | ||
ignore_failure: true | ||
ignore_missing: true | ||
- rename: | ||
field: sql | ||
target_field: mssql | ||
ignore_missing: true | ||
ignore_failure: true | ||
- rename: | ||
field: mssql.metrics.log_since_last_checkpoint_mb | ||
target_field: mssql.metrics.log_since_last_checkpoint | ||
ignore_missing: true | ||
ignore_failure: true | ||
- rename: | ||
field: mssql.metrics.log_recovery_size_mb | ||
target_field: mssql.metrics.log_recovery_size | ||
ignore_missing: true | ||
ignore_failure: true | ||
- rename: | ||
field: mssql.metrics.total_log_size_mb | ||
target_field: mssql.metrics.total_log_size | ||
ignore_missing: true | ||
ignore_failure: true | ||
- rename: | ||
field: mssql.metrics.active_log_size_mb | ||
target_field: mssql.metrics.active_log_size | ||
ignore_missing: true | ||
ignore_failure: true | ||
- rename: | ||
field: mssql.metrics.log_since_last_log_backup_mb | ||
target_field: mssql.metrics.log_since_last_log_backup | ||
ignore_missing: true | ||
ignore_failure: true | ||
- script: | ||
lang: painless | ||
source: ctx.mssql.metrics.log_since_last_checkpoint = Math.round(ctx.mssql.metrics.log_since_last_checkpoint * params.scale) | ||
params: | ||
scale: 1048576 | ||
if: ctx.mssql.metrics.log_since_last_checkpoint != null | ||
- script: | ||
lang: painless | ||
source: ctx.mssql.metrics.log_recovery_size = Math.round(ctx.mssql.metrics.log_recovery_size * params.scale) | ||
params: | ||
scale: 1048576 | ||
if: ctx.mssql.metrics.log_recovery_size != null | ||
- script: | ||
lang: painless | ||
source: ctx.mssql.metrics.total_log_size = Math.round(ctx.mssql.metrics.total_log_size * params.scale) | ||
params: | ||
scale: 1048576 | ||
if: ctx.mssql.metrics.total_log_size != null | ||
- script: | ||
lang: painless | ||
source: ctx.mssql.metrics.active_log_size = Math.round(ctx.mssql.metrics.active_log_size * params.scale) | ||
params: | ||
scale: 1048576 | ||
if: ctx.mssql.metrics.active_log_size != null | ||
- script: | ||
lang: painless | ||
source: ctx.mssql.metrics.log_since_last_log_backup = Math.round(ctx.mssql.metrics.log_since_last_log_backup * params.scale) | ||
params: | ||
scale: 1048576 | ||
if: ctx.mssql.metrics.log_since_last_log_backup != null | ||
on_failure: | ||
- set: | ||
field: error.message | ||
value: "{{ _ingest.on_failure_message }}" | ||
muthu-mps marked this conversation as resolved.
Show resolved
Hide resolved
|
8 changes: 8 additions & 0 deletions
8
packages/microsoft_sqlserver/data_stream/transaction_log/fields/base-fields.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
- name: data_stream.type | ||
external: ecs | ||
- name: data_stream.dataset | ||
external: ecs | ||
- name: data_stream.namespace | ||
external: ecs | ||
- name: '@timestamp' | ||
external: ecs |
6 changes: 6 additions & 0 deletions
6
packages/microsoft_sqlserver/data_stream/transaction_log/fields/ecs.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
- external: ecs | ||
name: ecs.version | ||
- external: ecs | ||
name: service.address | ||
- external: ecs | ||
name: service.type |
62 changes: 62 additions & 0 deletions
62
packages/microsoft_sqlserver/data_stream/transaction_log/fields/fields.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
- name: mssql | ||
type: group | ||
release: beta | ||
fields: | ||
- name: metrics | ||
type: group | ||
fields: | ||
- name: database_id | ||
muthu-mps marked this conversation as resolved.
Show resolved
Hide resolved
|
||
type: long | ||
dimension: true | ||
description: Unique ID of the database inside MSSQL. | ||
- name: database_name | ||
type: keyword | ||
description: Name of the database. | ||
- name: log_since_last_checkpoint | ||
type: long | ||
unit: byte | ||
metric_type: gauge | ||
description: Log size in bytes since last checkpoint log sequence number (LSN). | ||
- name: log_recovery_size | ||
type: long | ||
unit: byte | ||
metric_type: gauge | ||
description: Log size in bytes since log recovery log sequence number (LSN). | ||
muthu-mps marked this conversation as resolved.
Show resolved
Hide resolved
|
||
- name: total_log_size | ||
type: long | ||
unit: byte | ||
metric_type: counter | ||
description: Total log size. | ||
- name: log_backup_time | ||
type: date | ||
description: Last transaction log backup time. | ||
- name: active_log_size | ||
type: long | ||
unit: byte | ||
metric_type: counter | ||
description: Total active transaction log size in bytes. | ||
- name: log_since_last_log_backup | ||
type: long | ||
unit: byte | ||
metric_type: gauge | ||
description: Log file size since last backup in bytes. | ||
- name: used_log_space_pct | ||
type: float | ||
unit: percent | ||
metric_type: gauge | ||
description: A percentage of the occupied size of the log as a percent of the total log size. | ||
- name: used_log_space_bytes | ||
type: long | ||
unit: byte | ||
metric_type: gauge | ||
description: The occupied size of the log in bytes. | ||
- name: log_space_in_bytes_since_last_backup | ||
type: long | ||
unit: byte | ||
metric_type: gauge | ||
description: The amount of space used since the last log backup in bytes. | ||
- name: total_log_size_bytes | ||
type: long | ||
unit: byte | ||
metric_type: counter | ||
description: Total transaction log size in bytes. | ||
muthu-mps marked this conversation as resolved.
Show resolved
Hide resolved
|
16 changes: 16 additions & 0 deletions
16
packages/microsoft_sqlserver/data_stream/transaction_log/manifest.yml
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
type: metrics | ||
title: Microsoft SQL Server transaction_log metrics | ||
release: beta | ||
streams: | ||
- input: sql/metrics | ||
enabled: false | ||
vars: | ||
- name: period | ||
type: text | ||
title: Period | ||
multi: false | ||
required: true | ||
show_user: true | ||
default: 60s | ||
title: Microsoft SQL Server transaction_log metrics | ||
description: Collect Microsoft SQL Server transaction_log metrics |
47 changes: 47 additions & 0 deletions
47
packages/microsoft_sqlserver/data_stream/transaction_log/sample_event.json
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
{ | ||
"@timestamp": "2022-06-08T10:20:14.787809Z", | ||
"mssql": { | ||
"metrics": { | ||
"database_name": "msdb", | ||
"database_id": 1, | ||
"used_log_space_bytes": 41.17647171020508, | ||
"log_space_in_bytes_since_last_backup": 397312, | ||
"total_log_size_bytes": 2088960, | ||
"used_log_space_pct": 860160 | ||
} | ||
muthu-mps marked this conversation as resolved.
Show resolved
Hide resolved
|
||
}, | ||
"metricset": { | ||
"period": 10000, | ||
"name": "query" | ||
}, | ||
"agent": { | ||
"id": "e7b17c22-4223-46c3-b982-ff0d570b5fa6", | ||
"ephemeral_id": "d1a76cf4-2463-478a-a474-36e771218467", | ||
"type": "metricbeat", | ||
"version": "8.3.0" | ||
}, | ||
"service": { | ||
"address": "54.90.251.237:1433", | ||
"type": "sql" | ||
}, | ||
"elastic_agent": { | ||
"id": "e7b17c22-4223-46c3-b982-ff0d570b5fa6", | ||
"version": "8.3.0", | ||
"snapshot": true | ||
}, | ||
"event": { | ||
"duration": 5595352584, | ||
"agent_id_status": "verified", | ||
"ingested": "2022-05-23T10:20:21Z", | ||
"module": "sql", | ||
"dataset": "microsoft_sqlserver.transaction_log" | ||
}, | ||
"data_stream": { | ||
"namespace": "default", | ||
"type": "metrics", | ||
"dataset": "microsoft_sqlserver.transaction_log" | ||
}, | ||
"ecs": { | ||
"version": "8.0.0" | ||
} | ||
} |
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.