hartfordfive / protologbeat

Application accepting log data via TCP or UDP to then index the data in Elasticsearch
Other
27 stars 14 forks source link
elasticsearch json json-schema libbeat logging syslog tcp udp

Protologbeat

Description

This application is intended as a replacement for udplogbeat. Although quite similar, it does have some improvements and allows you to start up via either UDP or TCP. It can act accept plain-text or JSON logs and also act as a syslog destination replacement.

Ensure that this folder is at the following location: ${GOPATH}/github.com/harfordfive

Getting Started with Protologbeat

Configuration Options

Configuration Example

The following are examples of configuration blocks for the protologbeat section.

  1. Configuration block for plain-text logging
  2. Configuration block that enforces JSON schema only for indicated Elasticsearch types
  3. Configuration block that enforces JSON schema for all Elasticsearch types
  4. Configuration block for a syslog replacement, with custom ES type of 'myapp'

JSON schemas can be automatically generated from an object here: http://jsonschema.net/. You can also view the email_contact and stock_item schemas as examples.

Considerations

Sample Clients

Please see the _samples/ directory for examples of clients in various languages.

Requirements

Init Project

To get running with Protologbeat and also install the dependencies, run the following command:

make setup

It will create a clean git history for each major step. Note that you can always rewrite the history if you wish before pushing your changes.

To push Protologbeat in the git repository, run the following commands:

git remote set-url origin https://github.com/harfordfive/protologbeat
git push origin master

For further development, check out the beat developer guide.

Build

To build the binary for Protologbeat run the command below. This will generate a binary in the same directory with the name protologbeat.

make

If you'd like to build the binary for OSX, Linux and/or Windows, you can run the following:

./build-bin [TAG_VERSION]

The resulting binaries will be placed in the bin/ directory

Run

To run Protologbeat with debugging output enabled, run:

./protologbeat -c protologbeat.yml -e -d "*"

Test

To test Protologbeat, run the following command:

make testsuite

alternatively:

make unit-tests
make system-tests
make integration-tests
make coverage-report

The test coverage is reported in the folder ./build/coverage/

Update

Each beat has a template for the mapping in elasticsearch and a documentation for the fields which is automatically generated based on etc/fields.yml. To generate etc/protologbeat.template.json and etc/protologbeat.asciidoc

make update

Cleanup

To clean Protologbeat source code, run the following commands:

make fmt
make simplify

To clean up the build directory and generated artifacts, run:

make clean

Clone

To clone Protologbeat from the git repository, run the following commands:

mkdir -p ${GOPATH}/github.com/harfordfive
cd ${GOPATH}/github.com/harfordfive
git clone https://github.com/harfordfive/protologbeat

For further development, check out the beat developer guide.

Running on Docker

You can find the Docker images for this beat here. Please take note the container starts with a basic config that listens on the default protocol/address/port and accepts plain-text messages. For any customizations, please modify the sample protologbeat.full.yml config and create your own Docker file that overwrites the original.

Packaging

The beat frameworks provides tools to crosscompile and package your beat for different platforms. This requires docker and vendoring as described above. To build packages of your beat, run the following command:

make package

This will fetch and create all images required for the build process. The hole process to finish can take several minutes.