Skip to content
This repository was archived by the owner on Dec 18, 2024. It is now read-only.
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions DEVELOPER.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
# logstash-output-rollbar
Example output plugin. This should help bootstrap your effort to write your own output plugin!
2 changes: 1 addition & 1 deletion Gemfile
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
source 'https://rubygems.org'
gemspec
gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"

2 changes: 0 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -1,5 +1,3 @@
Copyright (c) 2012-2015 Elasticsearch <http://www.elasticsearch.org>

Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
You may obtain a copy of the License at
Expand Down
43 changes: 17 additions & 26 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,19 +1,19 @@
# Logstash Plugin

This is a plugin for [Logstash](https://github.com/elasticsearch/logstash) that sends events to the [Rollbar](https://www.rollbar.com) error monitoring service.
This is a plugin for [Logstash](https://github.com/elastic/logstash) that sends events to the [Rollbar](https://www.rollbar.com) error monitoring service.

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

Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elasticsearch.org/guide/en/logstash/current/).
Logstash provides infrastructure to automatically generate documentation for this plugin. We use the asciidoc format to write documentation so any comments in the source code will be first converted into asciidoc and then into html. All plugin documentation are placed under one [central location](http://www.elastic.co/guide/en/logstash/current/).

- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elasticsearch/docs#asciidoc-guide
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide

## Need Help?

Need help? Try #logstash on freenode IRC or the [email protected] mailing list.
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.

## Developing

Expand All @@ -22,7 +22,7 @@ Need help? Try #logstash on freenode IRC or the [email protected]
#### 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](https://github.com/logstash-plugins) organization.
- Create a new plugin or clone and existing from the GitHub [logstash-plugins](https://github.com/logstash-plugins) organization. We also provide [example plugins](https://github.com/logstash-plugins?query=example).

- Install dependencies
```sh
Expand All @@ -31,40 +31,29 @@ bundle install

#### Test

```sh
bundle exec rspec
```
- Update your dependencies

The Logstash code required to run the tests/specs is specified in the `Gemfile` by the line similar to:
```ruby
gem "logstash", :github => "elasticsearch/logstash", :branch => "1.5"
```
To test against another version or a local Logstash, edit the `Gemfile` to specify an alternative location, for example:
```ruby
gem "logstash", :github => "elasticsearch/logstash", :ref => "master"
```
```ruby
gem "logstash", :path => "/your/local/logstash"
```sh
bundle install
```

Then update your dependencies and run your tests:
- Run tests

```sh
bundle install
bundle exec rspec
```

### 2. Running your unpublished Plugin in Logstash

#### 2.1 Run in a local Logstash clone

- Edit Logstash `tools/Gemfile` and add the local plugin path, for example:
- Edit Logstash `Gemfile` and add the local plugin path, for example:
```ruby
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
```
- Update Logstash dependencies
- Install plugin
```sh
rake vendor:gems
bin/logstash-plugin install --no-verify
```
- Run Logstash with your plugin
```sh
Expand All @@ -74,13 +63,15 @@ At this point any modifications to the plugin code will be applied to this local

#### 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
```sh
gem build logstash-filter-awesome.gemspec
```
- Install the plugin from the Logstash home
```sh
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
bin/logstash-plugin install /your/local/plugin/logstash-filter-awesome.gem
```
- Start Logstash and proceed to test the plugin

Expand All @@ -90,6 +81,6 @@ All contributions are welcome: ideas, patches, documentation, bug reports, compl

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 me that you are able to contribute.
It is more important to the community that you are able to contribute.

For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
6 changes: 0 additions & 6 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,7 +1 @@
@files=[]

task :default do
system("rake -T")
end

require "logstash/devutils/rake"
127 changes: 127 additions & 0 deletions docs/index.asciidoc
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
:plugin: example
:type: output
:default_codec: plain
// Update header with plugin name and default codec

///////////////////////////////////////////
START - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////
:version: %VERSION%
:release_date: %RELEASE_DATE%
:changelog_url: %CHANGELOG_URL%
:include_path: ../../../../logstash/docs/include
///////////////////////////////////////////
END - GENERATED VARIABLES, DO NOT EDIT!
///////////////////////////////////////////

[id="plugins-{type}s-{plugin}"]

=== Example output plugin

include::{include_path}/plugin_header.asciidoc[]

==== Description

Add plugin description here

// Format anchors and links to support generated ids for versioning
// Sample anchor: [id="plugins-{type}s-{plugin}-setting_name"]
// Sample link: <<plugins-{type}s-{plugin}-setting_name>>

[id="plugins-{type}s-{plugin}-options"]
==== Example Output Configuration Options

[cols="<,<,<",options="header",]
|=======================================================================
|Setting |Input type|Required
| <<plugins-{type}s-{plugin}-a_setting_name>> |<<boolean,boolean>>|No
| <<plugins-{type}s-{plugin}-another_setting_name>> |<<hash,hash>>|No
| <<plugins-{type}s-{plugin}-setting_name_3>> |<<string,string>>|No
| <<plugins-{type}s-{plugin}-setting_name_4>> |<<number,number>>|No
| <<plugins-{type}s-{plugin}-setting_name_5>> |<<array,array>>|No
| <<plugins-{type}s-{plugin}-setting_name_6>> |<<bytes,bytes>>|No
| <<plugins-{type}s-{plugin}-setting_name_7>> |<<path,path>>|No
| <<plugins-{type}s-{plugin}-setting_name_8>> |<<password,password>>|No
| <<plugins-{type}s-{plugin}-setting_name_9>> |<<uri,uri>>|No
|=======================================================================

[id="plugins-{type}s-{plugin}-a_setting_name"]
===== `a_setting_name`

* Value type is <<boolean,boolean>>
* Default value is `true`

Add description here

[id="plugins-{type}s-{plugin}-another_setting_name"]
===== `another_setting_name`

* Value type is <<hash,hash>>
* Default value is `{}`

Add description here

[id="plugins-{type}s-{plugin}-setting_name_3"]
===== `setting_name_3`

* Value type is <<string,string>>
* Default value is `{}`

Add description here

[id="plugins-{type}s-{plugin}-setting_name_4"]
===== `setting_name_4`

* Value type is <<number,number>>
* Default value is `0`

Add description here

[id="plugins-{type}s-{plugin}-setting_name_5"]
===== `setting_name_5`

* Value type is <<array,array>>
* Default value is {}

Add description here

[id="plugins-{type}s-{plugin}-setting_name_6"]
===== `setting_name_6`

* Value type is <<bytes,bytes>>
* Default value is {}

Add description here

[id="plugins-{type}s-{plugin}-setting_name_7"]
===== `setting_name_7`

* Value type is <<path,path>>
* Default value is {}

Add description here

[id="plugins-{type}s-{plugin}-setting_name_8"]
===== `setting_name_8`

* Value type is <<password,password>>
* Default value is {}

Add description here


[id="plugins-{type}s-{plugin}-setting_name_9"]
===== `setting_name_9`

* Value type is <<uri,uri>>
* Default value is {}

Add description here

// The full list of Value Types is here:
// https://www.elastic.co/guide/en/logstash/current/configuration-file-structure.html

[id="plugins-{type}s-{plugin}-common-options"]
include::{include_path}/{type}.asciidoc[]

:default_codec!:
30 changes: 14 additions & 16 deletions logstash-output-rollbar.gemspec
Original file line number Diff line number Diff line change
@@ -1,27 +1,25 @@
Gem::Specification.new do |s|

s.name = 'logstash-output-rollbar'
s.version = '0.2.0'
s.licenses = ['Apache License (2.0)']
s.summary = "The Rollbar Logstash output sends events to the Rollbar error monitoring service."
s.description = "This gem is a logstash plugin. Install using: $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program"
s.authors = ["Rollbar"]
s.email = '[email protected]'
s.homepage = "https://github.com/rollbar/logstash-output-rollbar"
s.require_paths = ["lib"]
s.name = 'logstash-output-rollbar'
s.version = '0.2.0'
s.licenses = ['Apache-2.0']
s.summary = 'The Rollbar Logstash output sends events to the Rollbar error monitoring service.'
s.description = 'This gem is a logstash plugin. Install using: $LS_HOME/bin/plugin install gemname. This gem is not a stand-alone program'
s.authors = ['Rollbar']
s.email = '[email protected]'
s.homepage = 'https://github.com/rollbar/logstash-output-rollbar'
s.require_paths = ['lib']

# Files
s.files = `git ls-files`.split($\)+::Dir.glob('vendor/*')

# Tests
s.files = Dir['lib/**/*','spec/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
# Tests
s.test_files = s.files.grep(%r{^(test|spec|features)/})

# Special flag to let us know this is actually a logstash plugin
s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }

# Gem dependencies
s.add_runtime_dependency 'logstash-core', '>= 1.4.0', '< 2.0.0'

s.add_development_dependency 'logstash-devutils'
s.add_runtime_dependency "logstash-core-plugin-api", "~> 2.0"
s.add_runtime_dependency "logstash-codec-plain"
s.add_development_dependency "logstash-devutils"
end

21 changes: 21 additions & 0 deletions spec/outputs/rollbar_spec.rb
Original file line number Diff line number Diff line change
@@ -1 +1,22 @@
# encoding: utf-8
require "logstash/devutils/rspec/spec_helper"
require "logstash/outputs/rollbar"
require "logstash/codecs/plain"
require "logstash/event"

describe LogStash::Outputs::Rollbar do
let(:sample_event) { LogStash::Event.new }
let(:output) { LogStash::Outputs::Rollbar.new }

before do
output.register
end

describe "receive message" do
subject { output.receive(sample_event) }

it "returns a string" do
expect(subject).to eq("Event received")
end
end
end