Sign inSign up

jjcosgrove/beatbox

By jjcosgrove

•Updated over 9 years ago

A simple node app to help you monitor and analyse your server logs

Image
0

900

jjcosgrove/beatbox repository overview

⁠BeatBox

A simple node app to help you monitor and analyse your server logs

⁠Quickstart

⁠1. Pull
docker pull jjcosgrove/beatbox:latest
⁠2. Run
docker run -detached \
--name beatbox \
--publish 0.0.0.0:9999:9999 \
--link mongo:mongo \
--env "BB_HOST=127.0.0.1" \
--env "BB_PORT=9999" \
--env "BB_MONGO_HOST=mongo" \
--env "BB_MONGO_PORT=27017" \
--env "BB_MONGO_DB=beatbox" \
--env "BB_MONGO_DB_COLLECTION=beats" \
--add-host mongo:192.168.0.2 \
--restart always jjcosgrove/beatbox:latest

⁠Requirements

These should already be installed either locally, or via Docker so that you can integrate with BeatBox using the appropriate configurations.

⁠Configuration

Let's say you wish to run BeatBox locally on your main machine and that you already have an instance of MongoDB running on 127.0.0.1:27017, along with Filebeat and Logstash running on 127.0.0.1 and 127.0.0.1:9300

The various configs may look something like:

⁠Filebeat: filebeat.yml
filebeat:
    prospectors:
        -
            paths:
                - "/var/log/nginx/access.log"
            document_type: nginx
            tail_files: true
        -
            paths:
                - "/var/log/php/php7-fpm.log"
            document_type: php-fpm
            tail_files: true
        -
            paths:
                - "/var/log/system.log"
            document_type: system
            tail_files: true

output:
    logstash:
        hosts: ["127.0.0.1:9300"]
⁠Logstash: logstash.conf

Logstash not only needs to receive 'beats' from Filebeat but also needs to be able to PUT to the BeatBox API. As such, if Logstash is within another container, ensure your 'docker run' on logstash adds a host if necessary and/or you could place the BeatBox IP in the config file.

You would then typically make your Logstash container with:

docker run -detached \
--name logstash \
--publish 0.0.0.0:9300:9300 \
--volume /users/somebody/docker/persistent/logstash:/config \
--restart always logstash:latest -f /config/logstash.conf

Ensuring your config file is located at:

/users/somebody/docker/persistent/logstash/logstash.conf

So...

input {
   beats {
     type => beats
     port => 9300
   }
}
output {
   http {
    codec => "json"
    http_method => "put"
    format => "json"
    url => ["http://127.0.0.1:9999/api/beats"]
   }
}

Might be:

input {
   beats {
     type => beats
     port => 9300
   }
}
output {
   http {
    codec => "json"
    http_method => "put"
    format => "json"
    url => ["http://beatbox:9999/api/beats"]
   }
}

Or even:

input {
   beats {
     type => beats
     port => 9300
   }
}
output {
   http {
    codec => "json"
    http_method => "put"
    format => "json"
    url => ["http://192.168.0.2:9999/api/beats"]
   }
}
⁠BeatBox: config.yml (overridden via Docker --env flag)
# main BeatBox settings
bb_host                 : 127.0.0.1
bb_port                 : 9999

# filebeat/logstash timestamp field. must be ISO8601/moment() friendly
# i suggest you leave this as it, during initial testing. it is used
# to calculate 'epoch' which is in turn used for all UI timescaling/queries...
bb_beat_timestamp_field : @timestamp

# front-end/ui
bb_ui_date_format       : DD-MMM-Y  # via moment()
bb_ui_available_range   : 30        # days (or all available, whichever is smallest)
bb_ui_initial_range     : 3         # days (or all available, whichever is smallest)
bb_ui_beat_direction    : -1        # -1 = age ascending (newest at top), 1 = age descending (oldest at top)

# mongodb
bb_mongo_host           : 127.0.0.1
bb_mongo_port           : 27017
bb_mongo_db             : beatbox
bb_mongo_db_collection  : beats

Following the installation steps, you should then start seeing your logs come through. There is a small delay (3-5 seconds), presumably due to the chain: Filebeat > Logstash > BeatBox > UI. This may be simple to reduce but depends on your configuration/setup.

⁠Contribute

Bugs or feature requests/contributions can be done via: https://github.com/jjcosgrove/beatbox/issues⁠

⁠Authors

  • Just me for now

Tag summary

Content type

Image

Digest

Size

289.5 MB

Last updated

over 9 years ago

docker pull jjcosgrove/beatbox