Send data via Auditd to your Logstash instance provided by Logit.io

Auditd

Collect and ship Auditd logs to Logstash and Elasticsearch.

Filebeat is a lightweight shipper that enables you to send your Auditd application logs to Logstash and Elasticsearch. Configure Filebeat using the pre-defined examples below to start sending and analysing your Auditd application logs.

Step 1 - Install Filebeat

deb (Debian/Ubuntu/Mint)

sudo apt-get install apt-transport-https
wget -qO - https://artifacts.elastic.co/GPG-KEY-elasticsearch | sudo apt-key add -
echo 'deb https://artifacts.elastic.co/packages/oss-6.x/apt stable main' | sudo tee /etc/apt/sources.list.d/beats.list

sudo apt-get update && sudo apt-get install filebeat

rpm (CentOS/RHEL/Fedora)

sudo rpm --import https://artifacts.elastic.co/GPG-KEY-elasticsearch
echo "[elastic-6.x]
name=Elastic repository for 6.x packages
baseurl=https://artifacts.elastic.co/packages/oss-6.x/yum
gpgcheck=1
gpgkey=https://artifacts.elastic.co/GPG-KEY-elasticsearch
enabled=1
autorefresh=1
type=rpm-md" | sudo tee /etc/yum.repos.d/elastic-beats.repo

sudo yum install filebeat

Step 2 - Locate Configuration File

deb/rpm /etc/filebeat/filebeat.yml

Step 3 - Enable the Auditd Module

There are several built in filebeat modules you can use. To enable the Auditd module run.

deb/rpm

sudo filebeat modules list
sudo filebeat modules enable auditd

Additional module configuration can be done using the per module config files located in the modules.d folder, most commonly this would be to read logs from a non-default location

deb/rpm /etc/filebeat/modules.d/

Step 4 - Configure Output

We'll be shipping to Logstash so that we have the option to run filters before the data is indexed.
Comment out the elasticsearch output block as shown below:

## Comment out elasticsearch output
#output.elasticsearch:
#  hosts: ["localhost:9200"]

Uncomment and change the logstash output to match the example below:

output.logstash:
    hosts: ["your-logstash-host:your-port"]
    loadbalance: true
    ssl.enabled: true

Step 5 - (Optional) Update Logstash Filters

All Logit stacks come pre-configured with popular Logstash filters. We would recommend that you add Auditd specific filters if you don't already have them, to ensure enhanced dashboards and modules work correctly.

Edit your Logstash filters by choosing Stack > Settings > Logstash Filters

if [fileset][module] == "auditd" {
    grok {
         match => { 
             "message" => [ "%{AUDIT_PREFIX} %{AUDIT_KEY_VALUES:[auditd][log][kv]} old auid=%{NUMBER:[auditd][log][old_auid]} new auid=%{NUMBER:[auditd][log][new_auid]} old ses=%{NUMBER:[auditd][log][old_ses]} new ses=%{NUMBER:[auditd][log][new_ses]}", "%{AUDIT_PREFIX} %{AUDIT_KEY_VALUES:[auditd][log][kv]} msg=['\"](%{DATA:[auditd][log][msg]}\s+)?%{AUDIT_KEY_VALUES:[auditd][log][sub_kv]}['\"]", "%{AUDIT_PREFIX} %{AUDIT_KEY_VALUES:[auditd][log][kv]}", "%{AUDIT_PREFIX}", "%{AUDIT_TYPE} %{AUDIT_KEY_VALUES:[auditd][log][kv]}" ]
         }
         pattern_definitions => {
             "AUDIT_TYPE" => "^type=%{NOTSPACE:[auditd][log][record_type]}"
             "AUDIT_PREFIX" => "%{AUDIT_TYPE} msg=audit\(%{NUMBER:[auditd][log][epoch]}:%{NUMBER:[auditd][log][sequence]}\):(%{DATA})?"
             "AUDIT_KEY_VALUES" => "%{WORD}=%{GREEDYDATA}"
         }
    }
    date {
        match => [ "[auditd][log][epoch]", "UNIX" ]
        target => "@timestamp"
    }
    mutate {
        convert => { "[auditd][log][sequence]" => "integer" }
    }
    geoip {
        source => "[auditd][log][addr]"
        target => "[auditd][log][geoip]"
    }
}

Step 6 - Validate Configuration

Let's check the configuration file is syntactically correct.

Run the command below from the extracted archive dir:

sudo filebeat -e -c filebeat.yml

Step 7 - Start filebeat

Ok, time to start ingesting data!

deb/rpm

sudo systemctl enable filebeat
sudo systemctl start filebeat

Step 8 - Auditd dashboard

The Auditd module comes with a predefined Kibana dashboard. To view your dashboards for any of your Logit stacks, launch Kibana and choose Dashboards.

expand view

Expand View

compact view

Compact View

Return to Search
Sign Up