-
Notifications
You must be signed in to change notification settings - Fork 4.9k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Filebeat Osquery module This adds a Filebeat module for centralising osquery logs. osqueryd writes the results in JSON, which makes it fairly easy to ingest to the Elastic stack. The module uses the JSON decoding support in Filebeat, and then renames the fields to match the Beats naming conventions (most fields prefixed with osquery.result). There is an option (use_namespace: false) to leave the fields as they were in the original JSON, but changing that settings makes the sample dashboards unusable. This module comes with two dashboards, one for the compliance pack in osquery, the other for the ossec-rootkit pack. * Set read_timestamp * Clarified the unix_timestamp column * make update * Rename Kafka module `beat.read_time` to `read_timestamp`, which is documented
- Loading branch information
Showing
24 changed files
with
2,948 additions
and
3 deletions.
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
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
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,80 @@ | ||
//// | ||
This file is generated! See scripts/docs_collector.py | ||
//// | ||
|
||
[[filebeat-module-osquery]] | ||
:modulename: osquery | ||
|
||
== Osquery module | ||
|
||
The +{modulename}+ module collects and decodes the result logs written by | ||
https://osquery.readthedocs.io/en/latest/introduction/using-osqueryd/[osqueryd] | ||
in the JSON format. To set up osqueryd follow the osquery installation | ||
instructions for your operating system and configure the `filesystem` logging | ||
driver (the default). Make sure UTC timestamps are enabled. | ||
|
||
include::../include/what-happens.asciidoc[] | ||
|
||
|
||
[float] | ||
=== Compatibility | ||
|
||
The +{modulename}+ module was tested with logs from osquery version 2.10.2. | ||
Since the results are written in the JSON format, it is likely that this module | ||
works with any version of osquery. | ||
|
||
This module is available on Linux, macOS, and Windows. | ||
|
||
[float] | ||
=== Example dashboard | ||
|
||
This module comes with a sample dashboard for visualizing the data collected by | ||
the "compliance" pack. To collect this data, enable the `id-compliance` pack in | ||
the osquery configuration file. | ||
|
||
[role="screenshot"] | ||
image::./images/kibana-osquery-compatibility.png[] | ||
|
||
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 the syslog and authorization logs: | ||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: osquery | ||
result: | ||
enabled: true | ||
var.paths: ["/path/to/osqueryd.results.log*"] | ||
----- | ||
|
||
|
||
To specify the same settings at the command line, you use: | ||
|
||
["source","sh",subs="attributes"] | ||
----- | ||
./{beatname_lc} --modules {modulename} -M "osquery.result.var.paths=[/path/to/osqueryd.results.log*]" | ||
----- | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `result` fileset settings | ||
|
||
include::../include/var-paths.asciidoc[] | ||
|
||
*`var.use_namespace`*:: | ||
|
||
If true, all fields exported by this module are prefixed with `osquery.result`. | ||
Set to false to copy the fields in the root of the document. If enabled, this | ||
setting also disables the renaming of some fields (e.g. `hostIdentifier` to | ||
`host_identifier`). Note that if you set this to false, the sample dashboards | ||
coming with this module won't work correctly. The default is true. | ||
|
||
|
||
[float] | ||
=== Fields | ||
|
||
For a description of each field in the module, see the | ||
<<exported-fields-osquery,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
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,12 @@ | ||
- module: osquery | ||
result: | ||
enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: | ||
|
||
# If true, all fields created by this module are prefixed with | ||
# `osquery.result`. Set to false to copy the fields in the root | ||
# of the document. The default is true. | ||
#var.use_namespace: true |
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,12 @@ | ||
- module: osquery | ||
result: | ||
enabled: true | ||
|
||
# Set custom paths for the log files. If left empty, | ||
# Filebeat will choose the paths depending on your OS. | ||
#var.paths: | ||
|
||
# If true, all fields created by this module are prefixed with | ||
# `osquery.result`. Set to false to copy the fields in the root | ||
# of the document. The default is true. | ||
#var.use_namespace: true |
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,67 @@ | ||
:modulename: osquery | ||
|
||
== Osquery module | ||
|
||
The +{modulename}+ module collects and decodes the result logs written by | ||
https://osquery.readthedocs.io/en/latest/introduction/using-osqueryd/[osqueryd] | ||
in the JSON format. To set up osqueryd follow the osquery installation | ||
instructions for your operating system and configure the `filesystem` logging | ||
driver (the default). Make sure UTC timestamps are enabled. | ||
|
||
include::../include/what-happens.asciidoc[] | ||
|
||
|
||
[float] | ||
=== Compatibility | ||
|
||
The +{modulename}+ module was tested with logs from osquery version 2.10.2. | ||
Since the results are written in the JSON format, it is likely that this module | ||
works with any version of osquery. | ||
|
||
This module is available on Linux, macOS, and Windows. | ||
|
||
[float] | ||
=== Example dashboard | ||
|
||
This module comes with a sample dashboard for visualizing the data collected by | ||
the "compliance" pack. To collect this data, enable the `id-compliance` pack in | ||
the osquery configuration file. | ||
|
||
[role="screenshot"] | ||
image::./images/kibana-osquery-compatibility.png[] | ||
|
||
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 the syslog and authorization logs: | ||
|
||
["source","yaml",subs="attributes"] | ||
----- | ||
- module: osquery | ||
result: | ||
enabled: true | ||
var.paths: ["/path/to/osqueryd.results.log*"] | ||
----- | ||
|
||
|
||
To specify the same settings at the command line, you use: | ||
|
||
["source","sh",subs="attributes"] | ||
----- | ||
./{beatname_lc} --modules {modulename} -M "osquery.result.var.paths=[/path/to/osqueryd.results.log*]" | ||
----- | ||
|
||
include::../include/config-option-intro.asciidoc[] | ||
|
||
[float] | ||
==== `result` fileset settings | ||
|
||
include::../include/var-paths.asciidoc[] | ||
|
||
*`var.use_namespace`*:: | ||
|
||
If true, all fields exported by this module are prefixed with `osquery.result`. | ||
Set to false to copy the fields in the root of the document. If enabled, this | ||
setting also disables the renaming of some fields (e.g. `hostIdentifier` to | ||
`host_identifier`). Note that if you set this to false, the sample dashboards | ||
coming with this module won't work correctly. The default is true. |
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,9 @@ | ||
- key: osquery | ||
title: "Osquery" | ||
description: > | ||
Fields exported by the `osquery` module | ||
fields: | ||
- name: osquery | ||
type: group | ||
description: > | ||
fields: |
Oops, something went wrong.
94ad82c
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.
can i port osquery module back to filebeat5.4.0 by copy these yml?
94ad82c
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.
@jjqq2013 You caj try but I would not be surprised if it does not work because of some changes we made in the binary and the module side in 6.0. It should be quick to try it out.
94ad82c
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.
94ad82c
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.
It works!
Optionally, I copied osquery mapping json from 6.2.2 to
filebeat.template.json
and change
template.overwrite
to true inoutput.elasticsearch
section, so the complete filebeat.yml is94ad82c
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.
@jjqq2013 Cool to hear that you got it working and also sharing it here. Making newer modules working with older filebeat versions out of the box would be pretty nice, but we are not there yet. Hopefully upgrading filebeat is also not that bad ;-)
94ad82c
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.