-
Notifications
You must be signed in to change notification settings - Fork 4.9k
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
[Filebeat] MSSQL module #12079
Merged
Merged
[Filebeat] MSSQL module #12079
Changes from 8 commits
Commits
Show all changes
9 commits
Select commit
Hold shift + click to select a range
0c92513
Atomic commit
sayden 19feb2e
mage fmt update and make update
sayden b9baac7
Add convert_timezone and reorder a couple of fields
sayden 99e224d
...
sayden 380c3f1
Remove not needed step in the processor
sayden c7d3da2
Rename field and remove not used one
sayden 3098f43
Update OSS fields.asciidoc
sayden 7d76d6e
Update type of origin field
sayden dca6e89
Add new step in the pipeline
sayden 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 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 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 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,63 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[filebeat-module-mssql]] | ||
:modulename: mssql | ||
:has-dashboards: false | ||
|
||
== MSSQL module | ||
|
||
The +{modulename}+ module parses error logs created by MSSQL. | ||
|
||
include::../include/what-happens.asciidoc[] | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
include::../include/running-modules.asciidoc[] | ||
|
||
include::../include/configuring-intro.asciidoc[] | ||
|
||
The following example shows how to set paths in the +modules.d/{modulename}.yml+ | ||
file to override the default paths for Træfik logs: | ||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: mssql | ||
access: | ||
enabled: true | ||
var.paths: ["/var/opt/mssql/log/error*"] | ||
----- | ||
|
||
|
||
To specify the same settings at the command line, you use: | ||
|
||
["source","sh",subs="attributes"] | ||
----- | ||
-M "mssql.access.var.paths=[/var/opt/mssql/log/error*]" | ||
----- | ||
|
||
//set the fileset name used in the included example | ||
:fileset_ex: log | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `log` fileset settings | ||
|
||
include::../include/var-paths.asciidoc[] | ||
|
||
:has-dashboards!: | ||
|
||
:fileset_ex!: | ||
|
||
:modulename!: | ||
|
||
|
||
[float] | ||
=== Fields | ||
|
||
For a description of each field in the module, see the | ||
<<exported-fields-mssql,exported fields>> section. | ||
|
This file contains 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 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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 @@ | ||
- module: mssql | ||
# Fileset for native deployment | ||
log: | ||
enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: |
This file contains 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,50 @@ | ||
:modulename: mssql | ||
:has-dashboards: false | ||
|
||
== MSSQL module | ||
|
||
The +{modulename}+ module parses error logs created by MSSQL. | ||
|
||
include::../include/what-happens.asciidoc[] | ||
|
||
[float] | ||
=== Compatibility | ||
|
||
include::../include/running-modules.asciidoc[] | ||
|
||
include::../include/configuring-intro.asciidoc[] | ||
|
||
The following example shows how to set paths in the +modules.d/{modulename}.yml+ | ||
file to override the default paths for Træfik logs: | ||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: mssql | ||
access: | ||
enabled: true | ||
var.paths: ["/var/opt/mssql/log/error*"] | ||
----- | ||
|
||
|
||
To specify the same settings at the command line, you use: | ||
|
||
["source","sh",subs="attributes"] | ||
----- | ||
-M "mssql.access.var.paths=[/var/opt/mssql/log/error*]" | ||
----- | ||
|
||
//set the fileset name used in the included example | ||
:fileset_ex: log | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `log` fileset settings | ||
|
||
include::../include/var-paths.asciidoc[] | ||
|
||
:has-dashboards!: | ||
|
||
:fileset_ex!: | ||
|
||
:modulename!: |
This file contains 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 @@ | ||
- key: mssql | ||
title: "mssql" | ||
description: MS SQL Filebeat Module | ||
fields: | ||
- name: mssql | ||
type: group | ||
description: Fields from the MSSQL log files | ||
fields: |
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains 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,7 @@ | ||
- name: log | ||
description: Common log fields | ||
type: group | ||
fields: | ||
- name: origin | ||
description: Origin of the message, usually the server but it can also be a recovery process | ||
type: keyword |
This file contains 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,15 @@ | ||
type: log | ||
paths: | ||
{{ range $i, $path := .paths }} | ||
- {{$path}} | ||
{{ end }} | ||
exclude_files: [".gz$"] | ||
|
||
multiline.pattern: '^\d\d' | ||
multiline.negate: true | ||
multiline.match: after | ||
|
||
{{ if .convert_timezone }} | ||
processors: | ||
- add_locale: ~ | ||
{{ end }} |
This file contains 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,50 @@ | ||
{ | ||
sayden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"description": "Pipeline to parse MSSQL logs", | ||
"processors": [ | ||
{ | ||
"grok": { | ||
"field": "message", | ||
"patterns": ["%{MSSQL_DATE:date} %{DATA:mssql.log.origin} [ ]*%{GREEDYDATA:msg_temp}"], | ||
"pattern_definitions": { | ||
"MSSQL_DATE":"%{DATA} %{DATA}" | ||
} | ||
} | ||
}, | ||
{ | ||
"date": { | ||
"field": "date", | ||
"target_field": "@timestamp", | ||
"formats": ["yyyy-MM-dd HH:mm:ss.SS"], | ||
{< if .convert_timezone >}"timezone": "{{ event.timezone }}",{< end >} | ||
sayden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
"ignore_failure": true | ||
} | ||
}, | ||
{ | ||
"remove": { | ||
"field":"date", | ||
"ignore_missing": true | ||
} | ||
}, | ||
{ | ||
"rename": { | ||
"field": "message", | ||
"target_field": "log.original" | ||
} | ||
}, | ||
{ | ||
"rename": { | ||
"field": "msg_temp", | ||
"target_field": "message", | ||
"ignore_missing": true | ||
} | ||
} | ||
], | ||
"on_failure": [ | ||
{ | ||
"set": { | ||
"field": "error.message", | ||
"value": "{{ _ingest.on_failure_message }}" | ||
} | ||
} | ||
] | ||
} |
This file contains 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,22 @@ | ||
module_version: 1.0 | ||
|
||
var: | ||
- name: paths | ||
default: | ||
- /var/opt/mssql/log/error* | ||
os.darwin: | ||
- /var/opt/mssql/log/error* | ||
os.windows: | ||
- c:\ProgramFiles\Microsoft SQL Server\MSSQL.1MSSQL\LOG\ERRORLOG* | ||
os.linux: | ||
- /var/opt/mssql/log/error* | ||
- name: convert_timezone | ||
default: true | ||
# if ES < 6.1.0, this flag switches to false automatically when evaluating the | ||
# pipeline | ||
min_elasticsearch_version: | ||
version: 6.1.0 | ||
value: false | ||
|
||
ingest_pipeline: ingest/pipeline.json | ||
input: config/config.yml |
This file contains 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,21 @@ | ||
2019-05-03 09:01:09.99 Server Microsoft SQL Server 2017 (RTM-CU13) (KB4466404) - 14.0.3048.4 (X64) | ||
sayden marked this conversation as resolved.
Show resolved
Hide resolved
|
||
Nov 30 2018 12:57:58 | ||
Copyright (C) 2017 Microsoft Corporation | ||
Developer Edition (64-bit) on Linux (Ubuntu 16.04.5 LTS) | ||
2019-05-03 09:01:09.99 Server UTC adjustment: 0:00 | ||
2019-05-03 09:01:09.99 Server (c) Microsoft Corporation. | ||
2019-05-03 09:01:09.99 Server All rights reserved. | ||
2019-05-03 09:01:10.00 Server Server process ID is 4124. | ||
2019-05-03 09:01:10.00 Server Logging SQL Server messages in file '/var/opt/mssql/log/errorlog'. | ||
2019-05-03 09:01:10.00 Server Registry startup parameters: | ||
-d /var/opt/mssql/data/master.mdf | ||
-l /var/opt/mssql/data/mastlog.ldf | ||
-e /var/opt/mssql/log/errorlog | ||
2019-05-03 09:01:10.00 Server SQL Server detected 1 sockets with 6 cores per socket and 12 logical processors per socket, 12 total logical processors; using 12 logical processors based on SQL Server licensing. This is an informational message; no user action is required. | ||
2019-05-03 09:01:10.00 Server SQL Server is starting at normal priority base (=7). This is an informational message only. No user action is required. | ||
2019-05-03 09:01:10.00 Server Detected 25445 MB of RAM. This is an informational message; no user action is required. | ||
2019-05-03 09:01:10.00 Server Using conventional memory in the memory manager. | ||
2019-05-03 09:01:10.01 Server Large Page Allocated: 32MB | ||
2019-05-03 09:01:10.20 Server Buffer pool extension is already disabled. No action is n | ||
2019-05-03 09:01:11.93 spid22s Service Broker manager has started. | ||
2019-05-03 09:01:12.03 spid6s Recovery is complete. This is an informational message only. No user action is required. |
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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayden @jsoriano @exekias I'm thinking we should remove this config option completely and have
add_locale
always enabled and no option to disable it. It also means theconvert_timezone
config option completely disappears. WDYT?NOTE: This only applies to the new modules so here it would not be a breaking change if we follow up with this.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1 to remove
convert_timezone
. I think the only reason to have it would be to support ES versions that don't have thetimezone
field in the date processor, and we are not supporting them in any case.I would consider changing it even on existing modules, I'd say it is more a bugfix/enhancement. It would only be breaking for cases where the logs are being parsed with an incorrect timezone, and in these cases the change would be for good.
For cases where this needs to be customized or this is not wanted for any reason there is still the workaround of using processors.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
+1
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@sayden Could you open a PR for MSSQL to remove it?
@jsoriano Could you open a PR for a module with your proposed change. I think I need to see the code change to figure out if it's really not breaking :-)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PR open to follow with this discussion: #12410