Merge pull request #68 from defensivedepth/osquery

Osquery/Fleet initial enhancements
This commit is contained in:
Mike Reeves
2018-12-28 14:59:28 -05:00
committed by GitHub
6 changed files with 212 additions and 0 deletions

View File

@@ -2,6 +2,7 @@
{%- set HOSTNAME = salt['grains.get']('host', '') %}
{%- set BROVER = salt['pillar.get']('static:broversion', 'COMMUNITY') %}
{%- set WAZUHENABLED = salt['pillar.get']('static:wazuh_enabled', '1') %}
{%- set FLEETENABLED = salt['pillar.get']('static:fleet_enabled', '1') %}
name: {{ HOSTNAME }}
@@ -61,6 +62,18 @@ filebeat.prospectors:
{%- endif %}
{%- if FLEETENABLED == '1' %}
- type: log
paths:
- /osquery/logs/result.log
fields:
type: osquery
fields_under_root: true
clean_removed: false
close_removed: false
{%- endif %}
#----------------------------- Logstash output ---------------------------------
output.logstash:
# Boolean flag to enable or disable the output module.

View File

@@ -63,6 +63,7 @@ so-filebeat:
- /opt/so/log/suricata:/suricata:ro
- /opt/so/wazuh/logs/alerts/:/wazuh/alerts:ro
- /opt/so/wazuh/logs/archives/:/wazuh/archives:ro
- /opt/so/log/fleet/:/osquery/logs:ro
{%- if grains['role'] == 'so-master' %}
- /etc/pki/filebeat.crt:/usr/share/filebeat/filebeat.crt:ro
- /etc/pki/filebeat.key:/usr/share/filebeat/filebeat.key:ro

File diff suppressed because one or more lines are too long

View File

@@ -0,0 +1,23 @@
# Author: Josh Brower
# Last Update: 12/28/2018
# If log is tagged osquery and there is an eventid column, then cleanup and parse out the EventData column
filter {
if "osquery" in [tags] and [osquery][columns][eventid] {
mutate {
gsub => ["[osquery][columns][data]", "\\x0A", ""]
}
json {
source => "[osquery][columns][data]"
target => "[osquery][columns][data]"
}
mutate {
merge => { "[osquery][columns]" => "[osquery][columns][data]" }
remove_field => ["[osquery][columns][data]"]
}
}
}

View File

@@ -0,0 +1,19 @@
{%- if grains['role'] == 'so-eval' -%}
{%- set ES = salt['pillar.get']('master:mainip', '') -%}
{%- else %}
{%- set ES = salt['pillar.get']('node:mainip', '') -%}
{%- endif %}
# Author: Josh Brower
# Last Update: 12/28/2018
# Output to ES for osquery tagged logs
output {
if "osquery" in [tags] {
elasticsearch {
hosts => "{{ ES }}"
index => "logstash-osquery-%{+YYYY.MM.dd}"
template => "/logstash-template.json"
}
}
}

View File

@@ -25,5 +25,16 @@ filter {
add_field => { "syslog-host_from" => "%{[beat][name]}" }
remove_field => [ "beat", "prospector", "input", "offset" ]
}
if [type] == "osquery" {
mutate {
remove_tag => ["beat"]
add_tag => ["osquery"]
}
json {
source => "message"
target => "osquery"
}
}
}