• Stars
    star
    187
  • Rank 206,464 (Top 5 %)
  • Language
    Ruby
  • License
    Other
  • Created almost 10 years ago
  • Updated over 4 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

MongoDB input plugin for Logstash

Logstash Plugin

This is a plugin for Logstash.

It is fully free and fully open source. The license is Apache 2.0, meaning you are pretty much free to use it however you want in whatever way.

Documentation

This is a logstash plugin for pulling data out of mongodb and processing with logstash. It will connect to the database specified in uri, use the collection attribute to find collections to pull documents from, start at the first collection it finds and pull the number of documents specified in batch_size, save it's progress in an sqlite database who's location is specified by placeholder_db_dir and placeholder_db_name and repeat. It will continue this until it no longer finds documents newer than ones that it has processed, sleep for a moment, then continue to loop over the collections.

This was designed for parsing logs that were written into mongodb. This means that it may not re-parse db entries that were changed and already parsed.

Installation

  • Logstash installed from ZIP | TGZ

    • bin/plugin install /path/to/logstash-input-mongodb-0.3.0.gem
  • Logstash from GIT

    • git clone https://github.com/elastic/logstash.git
    • cd logstash
    • (ensure that the correct jruby is installed for the version of logstash you are installing)
    • rake test:install-core
    • bin/plugin install /path/to/logstash-input-mongodb-0.3.0.gem
    • bin/plugin install --development

Configuration Options

Name                 Type          Description
uri                  [String]      A MongoDB URI for your database or cluster (check the MongoDB documentation for further info on this) [No Default, Required]
placeholder_db_dir   [String]      Path where the place holder database will be stored locally to disk [No Default, Required]
  This gets created by the plugin so the directory needs to be writeable by the user that logstash is running as
placeholder_db_name  [String]      Name of the database file that will be created [Default: logstash_sqlite.db]
collection           [String]      A regex that will be used to find desired collecitons. [No Default, Required]
generateId           [Boolean]     If true, this will add a field '_id' that contains the MongoDB Document id
batch_size           [Int]         Size of the batch of mongo documents to pull at a time [Default: 30]
parse_method         [String]      Built in parsing of the mongodb document object [Default: 'flatten']
dig_fields           [Array]       An array of fields that should employ the dig method
dig_dig_fields       [Array]       This provides a second level of hash flattening after the initial dig has been done

Configuration

Example

input {
  mongodb {
    uri => 'mongodb://10.0.0.30/my-logs?ssl=true'
    placeholder_db_dir => '/opt/logstash-mongodb/'
    placeholder_db_name => 'logstash_sqlite.db'
    collection => 'events_'
    batch_size => 5000
  }
}

filter {
  date {
    match => [ "logdate", "ISO8601" ]
  }
}

output {
  redis {
    host => "localhost"
    data_type => "list"
    key => "logstash-mylogs"
  }
}

MongoDB URI

The URI parameter is where you would specify all of your mongodb options including things like auth and SSL. You should use a connection string (URI) compatible with the mongodb spec.

For more information on MongoDB URI's please see the MongoDB documentation: https://docs.mongodb.org/v3.0/reference/connection-string/

More Repositories

1

pipo

Secure end to end client side encryption chat
JavaScript
50
star
2

kubernetes-ssl-manager

Manages and automates SSL certificate creation and renewal in Kubernetes via Letsencrypt
Shell
19
star
3

blue

Card based work flow and project management tool
JavaScript
6
star
4

bitfaucet

OpenSource Faucet for BitCoins on Testnet
CSS
5
star
5

kubesync

Kubernetes bi-directional sync utility
Go
3
star
6

dot-files

My dotfiles
Shell
3
star
7

zabbix-helpers

Helper scripts configs and notes for Zabbix
Shell
2
star
8

storj-cdnproxy

An application to fill http/https object requests from a Storj bucket
JavaScript
2
star
9

es-archivist

A tool to automate the archival of the oldest indices in Elasticsearch according to a configured rules
Go
2
star
10

pw-gen

Password generator
HTML
1
star
11

knife-attr

Knife plugin for manipulating attributes across multiple chef nodes using a chef search
Ruby
1
star
12

bigbang

Cross platform workstation setup and configuration framework
Shell
1
star
13

logstash-filter-kubernetes_metadata

Logstash filter for parsing kubernetes metadata and adding to log entries
Ruby
1
star
14

chef-base

Chef cookbook for managing basics across all nodes in your infrastructure
Ruby
1
star
15

elk-helpers

Helper configs, scripts and grok patterns for ELK stacks
Shell
1
star
16

nodeauto

Config management and cluster automation engine in NodeJS
1
star
17

stuffwiththings

Automation tools for various tasks
Ruby
1
star
18

eth-scripts

Ethereum related scripts, contracts, etc...
JavaScript
1
star
19

laravel-contacts-importer

Contact importer built in Laravel using Vue.js, Vuex, Redis Queueing, and Docker
PHP
1
star
20

chef-bitcoind

Chef cookbook for setting up bitcoind
Ruby
1
star
21

dimo-node

Deployment and management of DIMO nodes and related infrastructure
Go
1
star
22

exercism

Exercism programming language learning lessons
Go
1
star
23

k8s-manifest-sync

A go application that sync's the state of Kubernetes configuration files between disk and Kubernetes
Go
1
star
24

knife-pin

Knife plugin to bump version a cookbook is pinned to on a node using chef search
Ruby
1
star