Logstash Plugin

This is a plugin for Logstash. It support SolrCloud, not only Standalone Solr.

Forked from mosuka/logstash-output-solr.

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.

Config parameters

url

The server url for standalone Solr (for example http://localhost:8983/solr/collection1).

url http://localhost:8983/solr/collection1

zk_host

The ZooKeeper connection string that SolrCloud refers to (for example localhost:2181/solr).

zk_host localhost:2181/solr

collection

The SolrCloud collection name (default collection1).

collection collection1

collection_field

A field name with the name of collection to send events to. If this property is nil (the default) then collection property is used. This feature allows to have a single Logstash pipeline that does Solr indexing into multiple Solr collections and is useful for Pipeline-to-Pipeline Communication).

collection_field collection

commit

Commit every batch of events? (default false)

commit true

commitWithin

Defines how often (in ms) you want your events to be visible in Solr (default 10000, i.e. 10 seconds). For more information please see commitWithin docs

commitWithin 10000

unique_key_field

A field name of unique key in the Solr schema.xml (default id).

unique_key_field id

timestamp_field

A field name of event timestamp in the Solr schema.xml (default timestamp_tdt).

timestamp_field timestamp_tdt

flush_size

A number of events to queue up before writing to Solr (default 100).

flush_size 100

Plugin setup examples

Send events to standalone Solr.

output {
  solr {
    url => "http://localhost:8983/solr/collection1"
  }
}

Send events to SolrCloud cluster.

output {
  solr {
    zk_host => "localhost:2181/solr"
    collection => "collection1"
  }
}

Need Help?

Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.

Developing

1. Plugin Developement and Testing

Code

  • To get started, you'll need JRuby with the Bundler gem installed.

  • Create a new plugin or clone and existing from the GitHub logstash-plugins organization. We also provide example plugins.

  • Install dependencies

    bundle install
    

Test

  • Update your dependencies
bundle install
  • Run tests
bundle exec rspec

2. Running your unpublished Plugin in Logstash

2.1 Run in a local Logstash clone

  • Edit Logstash Gemfile and add the local plugin path, for example:
gem "logstash-output-solr-lw", :path => "/your/local/logstash-output-solr-lw"
  • Install plugin
bin/plugin install --no-verify
  • Run Logstash with your plugin
bin/logstash -e 'output {solr {}}'

At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.

2.2 Run in an installed Logstash

You can use the same 2.1 method to run your plugin in an installed Logstash by editing its Gemfile and pointing the :path to your local plugin development directory or you can build the gem and install it using:

  • Build your plugin gem
gem build logstash-output-solr-lw.gemspec
  • Install the plugin from the Logstash home
bin/plugin install /your/local/plugin/logstash-output-solr-lw.gem
  • Start Logstash and proceed to test the plugin

Contributing

All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.

Programming is not a required skill. Whatever you've seen about open source and maintainers or community members saying "send patches or die" - you will not see that here.

It is more important to the community that you are able to contribute.

For more information about contributing, see the CONTRIBUTING file.