logstash-output-custom_solr_http 4.1.0

Sign up to get free protection for your applications and to get access to all the features.
@@ -0,0 +1,7 @@
1
+ ---
2
+ SHA256:
3
+ metadata.gz: bf1f946654f2146eb59ecd7bd2b76d076180a745ed2ab83d00ad432d8fd2bb9d
4
+ data.tar.gz: 6bfcd8d41cce3f76279f147749ec5ddc7d9dc551c046c5b8ae0c4c21ad44af0f
5
+ SHA512:
6
+ metadata.gz: 141ba046b29f601da2eb999d4c824adad4e6c9369efffebcb968e53e0c6d9a3b1bc05fcfb05c5942647af32e9dd807353c90ddc974599bd5ee3e4e00eefb8574
7
+ data.tar.gz: aaa59cceafd4b5212da1a880f2c54eb1044eea6c35bc4a152b125d172878646a8be1d923e788051cab40e41876b65c1304c39054d8dffbdbf224ccfdb4a5f9e9
@@ -0,0 +1,23 @@
1
+ ## 3.0.5
2
+ - Docs: Set the default_codec doc attribute.
3
+
4
+ ## 3.0.4
5
+ - Update gemspec summary
6
+
7
+ ## 3.0.3
8
+ - Fix some documentation issues
9
+
10
+ ## 3.0.1
11
+ - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
12
+
13
+ # 3.0.0
14
+ - Breaking: Updated plugin to use new Java Event APIs
15
+ - Make TravisCI use JRuby 1.7.25
16
+ # 2.0.4
17
+ - Depend on logstash-core-plugin-api instead of logstash-core, removing the need to mass update plugins on major releases of logstash
18
+ # 2.0.3
19
+ - New dependency requirements for logstash-core for the 5.0 release
20
+ ## 2.0.0
21
+ - Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
22
+ instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
23
+ - Dependency on logstash-core update to 2.0
@@ -0,0 +1,15 @@
1
+ The following is a list of people who have contributed ideas, code, bug
2
+ reports, or in general have helped logstash along its way.
3
+
4
+ Contributors:
5
+ * Aaron Mildenstein (untergeek)
6
+ * Jordan Sissel (jordansissel)
7
+ * Kurt Hurtado (kurtado)
8
+ * Pier-Hugues Pellerin (ph)
9
+ * Radu Gheorghe (radu-gheorghe)
10
+ * Richard Pijnenburg (electrical)
11
+
12
+ Note: If you've sent us patches, bug reports, or otherwise contributed to
13
+ Logstash, and you aren't on the list above and want to be, please let us know
14
+ and we'll make sure you're here. Contributions from folks like you are what make
15
+ open source awesome.
data/Gemfile ADDED
@@ -0,0 +1,11 @@
1
+ source 'https://rubygems.org'
2
+
3
+ gemspec
4
+
5
+ logstash_path = ENV["LOGSTASH_PATH"] || "../../logstash"
6
+ use_logstash_source = ENV["LOGSTASH_SOURCE"] && ENV["LOGSTASH_SOURCE"].to_s == "1"
7
+
8
+ if Dir.exist?(logstash_path) && use_logstash_source
9
+ gem 'logstash-core', :path => "#{logstash_path}/logstash-core"
10
+ gem 'logstash-core-plugin-api', :path => "#{logstash_path}/logstash-core-plugin-api"
11
+ end
data/LICENSE ADDED
@@ -0,0 +1,13 @@
1
+ Copyright (c) 2012-2018 Elasticsearch <http://www.elastic.co>
2
+
3
+ Licensed under the Apache License, Version 2.0 (the "License");
4
+ you may not use this file except in compliance with the License.
5
+ You may obtain a copy of the License at
6
+
7
+ http://www.apache.org/licenses/LICENSE-2.0
8
+
9
+ Unless required by applicable law or agreed to in writing, software
10
+ distributed under the License is distributed on an "AS IS" BASIS,
11
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12
+ See the License for the specific language governing permissions and
13
+ limitations under the License.
@@ -0,0 +1,5 @@
1
+ Elasticsearch
2
+ Copyright 2012-2015 Elasticsearch
3
+
4
+ This product includes software developed by The Apache Software
5
+ Foundation (http://www.apache.org/).
@@ -0,0 +1,98 @@
1
+ # Logstash Plugin
2
+
3
+ [![Travis Build Status](https://travis-ci.org/logstash-plugins/logstash-output-solr_http.svg)](https://travis-ci.org/logstash-plugins/logstash-output-solr_http)
4
+
5
+ This is a plugin for [Logstash](https://github.com/elastic/logstash).
6
+
7
+ 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.
8
+
9
+ ## Documentation
10
+
11
+ 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/).
12
+
13
+ - For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
14
+ - For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
15
+
16
+ ## Need Help?
17
+
18
+ Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
19
+
20
+ ## Developing
21
+
22
+ ### 1. Plugin Developement and Testing
23
+
24
+ #### Code
25
+ - To get started, you'll need JRuby with the Bundler gem installed.
26
+
27
+ - 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).
28
+
29
+ - Install dependencies
30
+ ```sh
31
+ bundle install
32
+ ```
33
+
34
+ #### Test
35
+
36
+ - Update your dependencies
37
+
38
+ ```sh
39
+ bundle install
40
+ ```
41
+
42
+ - Run tests
43
+
44
+ ```sh
45
+ bundle exec rspec
46
+ ```
47
+
48
+ ### 2. Running your unpublished Plugin in Logstash
49
+
50
+ #### 2.1 Run in a local Logstash clone
51
+
52
+ - Edit Logstash `Gemfile` and add the local plugin path, for example:
53
+ ```ruby
54
+ gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
55
+ ```
56
+ - Install plugin
57
+ ```sh
58
+ # Logstash 2.3 and higher
59
+ bin/logstash-plugin install --no-verify
60
+
61
+ # Prior to Logstash 2.3
62
+ bin/plugin install --no-verify
63
+
64
+ ```
65
+ - Run Logstash with your plugin
66
+ ```sh
67
+ bin/logstash -e 'filter {awesome {}}'
68
+ ```
69
+ At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
70
+
71
+ #### 2.2 Run in an installed Logstash
72
+
73
+ 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:
74
+
75
+ - Build your plugin gem
76
+ ```sh
77
+ gem build logstash-filter-awesome.gemspec
78
+ ```
79
+ - Install the plugin from the Logstash home
80
+ ```sh
81
+ # Logstash 2.3 and higher
82
+ bin/logstash-plugin install --no-verify
83
+
84
+ # Prior to Logstash 2.3
85
+ bin/plugin install --no-verify
86
+
87
+ ```
88
+ - Start Logstash and proceed to test the plugin
89
+
90
+ ## Contributing
91
+
92
+ All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
93
+
94
+ 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.
95
+
96
+ It is more important to the community that you are able to contribute.
97
+
98
+ For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
@@ -0,0 +1,95 @@
1
+ :plugin: solr_http
2
+ :type: output
3
+ :default_codec: plain
4
+
5
+ ///////////////////////////////////////////
6
+ START - GENERATED VARIABLES, DO NOT EDIT!
7
+ ///////////////////////////////////////////
8
+ :version: %VERSION%
9
+ :release_date: %RELEASE_DATE%
10
+ :changelog_url: %CHANGELOG_URL%
11
+ :include_path: ../../../../logstash/docs/include
12
+ ///////////////////////////////////////////
13
+ END - GENERATED VARIABLES, DO NOT EDIT!
14
+ ///////////////////////////////////////////
15
+
16
+ [id="plugins-{type}s-{plugin}"]
17
+
18
+ === Solr_http output plugin
19
+
20
+ include::{include_path}/plugin_header.asciidoc[]
21
+
22
+ ==== Description
23
+
24
+ This output lets you index&store your logs in Solr. If you want to get
25
+ started quickly you should use version 4.4 or above in schemaless mode,
26
+ which will try and guess your fields automatically. To turn that on,
27
+ you can use the example included in the Solr archive:
28
+ [source,shell]
29
+ tar zxf solr-4.4.0.tgz
30
+ cd example
31
+ mv solr solr_ #back up the existing sample conf
32
+ cp -r example-schemaless/solr/ . #put the schemaless conf in place
33
+ java -jar start.jar #start Solr
34
+
35
+ You can learn more at https://lucene.apache.org/solr/[the Solr home page]
36
+
37
+ [id="plugins-{type}s-{plugin}-options"]
38
+ ==== Solr_http Output Configuration Options
39
+
40
+ This plugin supports the following configuration options plus the <<plugins-{type}s-{plugin}-common-options>> described later.
41
+
42
+ [cols="<,<,<",options="header",]
43
+ |=======================================================================
44
+ |Setting |Input type|Required
45
+ | <<plugins-{type}s-{plugin}-document_id>> |<<string,string>>|No
46
+ | <<plugins-{type}s-{plugin}-flush_size>> |<<number,number>>|No
47
+ | <<plugins-{type}s-{plugin}-idle_flush_time>> |<<number,number>>|No
48
+ | <<plugins-{type}s-{plugin}-solr_url>> |<<string,string>>|No
49
+ |=======================================================================
50
+
51
+ Also see <<plugins-{type}s-{plugin}-common-options>> for a list of options supported by all
52
+ output plugins.
53
+
54
+ &nbsp;
55
+
56
+ [id="plugins-{type}s-{plugin}-document_id"]
57
+ ===== `document_id`
58
+
59
+ * Value type is <<string,string>>
60
+ * Default value is `nil`
61
+
62
+ Solr document ID for events. You'd typically have a variable here, like
63
+ '%{foo}' so you can assign your own IDs
64
+
65
+ [id="plugins-{type}s-{plugin}-flush_size"]
66
+ ===== `flush_size`
67
+
68
+ * Value type is <<number,number>>
69
+ * Default value is `100`
70
+
71
+ Number of events to queue up before writing to Solr
72
+
73
+ [id="plugins-{type}s-{plugin}-idle_flush_time"]
74
+ ===== `idle_flush_time`
75
+
76
+ * Value type is <<number,number>>
77
+ * Default value is `1`
78
+
79
+ Amount of time since the last flush before a flush is done even if
80
+ the number of buffered events is smaller than flush_size
81
+
82
+ [id="plugins-{type}s-{plugin}-solr_url"]
83
+ ===== `solr_url`
84
+
85
+ * Value type is <<string,string>>
86
+ * Default value is `"http://localhost:8983/solr"`
87
+
88
+ URL used to connect to Solr
89
+
90
+
91
+
92
+ [id="plugins-{type}s-{plugin}-common-options"]
93
+ include::{include_path}/{type}.asciidoc[]
94
+
95
+ :default_codec!:
@@ -0,0 +1,78 @@
1
+ # encoding: utf-8
2
+ require "logstash/outputs/base"
3
+ require "logstash/namespace"
4
+ require "stud/buffer"
5
+ require "rubygems"
6
+ require "uuidtools"
7
+
8
+
9
+ # This output lets you index&store your logs in Solr. If you want to get
10
+ # started quickly you should use version 4.4 or above in schemaless mode,
11
+ # which will try and guess your fields automatically. To turn that on,
12
+ # you can use the example included in the Solr archive:
13
+ # [source,shell]
14
+ # tar zxf solr-4.4.0.tgz
15
+ # cd example
16
+ # mv solr solr_ #back up the existing sample conf
17
+ # cp -r example-schemaless/solr/ . #put the schemaless conf in place
18
+ # java -jar start.jar #start Solr
19
+ #
20
+ # You can learn more at https://lucene.apache.org/solr/[the Solr home page]
21
+
22
+ class LogStash::Outputs::SolrHTTP < LogStash::Outputs::Base
23
+ include Stud::Buffer
24
+
25
+ config_name "solr_http"
26
+
27
+
28
+ # URL used to connect to Solr
29
+ config :solr_url, :validate => :string, :default => "http://localhost:8983/solr"
30
+
31
+ # Number of events to queue up before writing to Solr
32
+ config :flush_size, :validate => :number, :default => 100
33
+
34
+ # Amount of time since the last flush before a flush is done even if
35
+ # the number of buffered events is smaller than flush_size
36
+ config :idle_flush_time, :validate => :number, :default => 1
37
+
38
+ # Solr document ID for events. You'd typically have a variable here, like
39
+ # '%{foo}' so you can assign your own IDs
40
+ config :document_id, :validate => :string, :default => nil
41
+
42
+ public
43
+ def register
44
+ require "rsolr"
45
+ @solr = RSolr.connect :url => @solr_url
46
+ buffer_initialize(
47
+ :max_items => @flush_size,
48
+ :max_interval => @idle_flush_time,
49
+ :logger => @logger
50
+ )
51
+ end #def register
52
+
53
+ public
54
+ def receive(event)
55
+
56
+ buffer_receive(event)
57
+ end #def receive
58
+
59
+ public
60
+ def flush(events, close=false)
61
+ documents = [] #this is the array of hashes that we push to Solr as documents
62
+
63
+ events.each do |event|
64
+ document = event.to_hash()
65
+ #document["@timestamp"] = document["@timestamp"].iso8601 #make the timestamp ISO
66
+ if @document_id.nil?
67
+ document ["id"] = UUIDTools::UUID.random_create #add a unique ID
68
+ else
69
+ document ["id"] = event.sprintf(@document_id) #or use the one provided
70
+ end
71
+ documents.push(document)
72
+ end
73
+
74
+ @solr.add(documents, :add_attributes => {:commitWithin=>10000})
75
+ rescue Exception => e
76
+ @logger.warn("An error occurred while indexing: #{e.message}")
77
+ end #def flush
78
+ end #class LogStash::Outputs::SolrHTTP
@@ -0,0 +1,30 @@
1
+ Gem::Specification.new do |s|
2
+
3
+ s.name = 'logstash-output-custom_solr_http'
4
+ s.version = '4.1.0'
5
+ s.licenses = ['Apache License (2.0)']
6
+ s.summary = "Stores and indexes logs in Solr"
7
+ s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
8
+ s.authors = ["Elastic"]
9
+ s.email = 'info@elastic.co'
10
+ s.homepage = "http://www.elastic.co/guide/en/logstash/current/index.html"
11
+ s.require_paths = ["lib"]
12
+
13
+ # Files
14
+ s.files = Dir["lib/**/*","spec/**/*","*.gemspec","*.md","CONTRIBUTORS","Gemfile","LICENSE","NOTICE.TXT", "vendor/jar-dependencies/**/*.jar", "vendor/jar-dependencies/**/*.rb", "VERSION", "docs/**/*"]
15
+
16
+ # Tests
17
+ s.test_files = s.files.grep(%r{^(test|spec|features)/})
18
+
19
+ # Special flag to let us know this is actually a logstash plugin
20
+ s.metadata = { "logstash_plugin" => "true", "logstash_group" => "output" }
21
+
22
+ # Gem dependencies
23
+ s.add_runtime_dependency "logstash-core-plugin-api", ">= 1.60", "<= 2.99"
24
+
25
+ s.add_runtime_dependency 'stud'
26
+ s.add_runtime_dependency 'rsolr'
27
+ s.add_runtime_dependency 'uuidtools'
28
+
29
+ s.add_development_dependency 'logstash-devutils'
30
+ end
@@ -0,0 +1 @@
1
+ require "logstash/devutils/rspec/spec_helper"
metadata ADDED
@@ -0,0 +1,134 @@
1
+ --- !ruby/object:Gem::Specification
2
+ name: logstash-output-custom_solr_http
3
+ version: !ruby/object:Gem::Version
4
+ version: 4.1.0
5
+ platform: ruby
6
+ authors:
7
+ - Elastic
8
+ autorequire:
9
+ bindir: bin
10
+ cert_chain: []
11
+ date: 2018-05-09 00:00:00.000000000 Z
12
+ dependencies:
13
+ - !ruby/object:Gem::Dependency
14
+ requirement: !ruby/object:Gem::Requirement
15
+ requirements:
16
+ - - ">="
17
+ - !ruby/object:Gem::Version
18
+ version: '1.60'
19
+ - - "<="
20
+ - !ruby/object:Gem::Version
21
+ version: '2.99'
22
+ name: logstash-core-plugin-api
23
+ prerelease: false
24
+ type: :runtime
25
+ version_requirements: !ruby/object:Gem::Requirement
26
+ requirements:
27
+ - - ">="
28
+ - !ruby/object:Gem::Version
29
+ version: '1.60'
30
+ - - "<="
31
+ - !ruby/object:Gem::Version
32
+ version: '2.99'
33
+ - !ruby/object:Gem::Dependency
34
+ requirement: !ruby/object:Gem::Requirement
35
+ requirements:
36
+ - - ">="
37
+ - !ruby/object:Gem::Version
38
+ version: '0'
39
+ name: stud
40
+ prerelease: false
41
+ type: :runtime
42
+ version_requirements: !ruby/object:Gem::Requirement
43
+ requirements:
44
+ - - ">="
45
+ - !ruby/object:Gem::Version
46
+ version: '0'
47
+ - !ruby/object:Gem::Dependency
48
+ requirement: !ruby/object:Gem::Requirement
49
+ requirements:
50
+ - - ">="
51
+ - !ruby/object:Gem::Version
52
+ version: '0'
53
+ name: rsolr
54
+ prerelease: false
55
+ type: :runtime
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - ">="
59
+ - !ruby/object:Gem::Version
60
+ version: '0'
61
+ - !ruby/object:Gem::Dependency
62
+ requirement: !ruby/object:Gem::Requirement
63
+ requirements:
64
+ - - ">="
65
+ - !ruby/object:Gem::Version
66
+ version: '0'
67
+ name: uuidtools
68
+ prerelease: false
69
+ type: :runtime
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - ">="
73
+ - !ruby/object:Gem::Version
74
+ version: '0'
75
+ - !ruby/object:Gem::Dependency
76
+ requirement: !ruby/object:Gem::Requirement
77
+ requirements:
78
+ - - ">="
79
+ - !ruby/object:Gem::Version
80
+ version: '0'
81
+ name: logstash-devutils
82
+ prerelease: false
83
+ type: :development
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - ">="
87
+ - !ruby/object:Gem::Version
88
+ version: '0'
89
+ description: This gem is a Logstash plugin required to be installed on top of the
90
+ Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This
91
+ gem is not a stand-alone program
92
+ email: info@elastic.co
93
+ executables: []
94
+ extensions: []
95
+ extra_rdoc_files: []
96
+ files:
97
+ - CHANGELOG.md
98
+ - CONTRIBUTORS
99
+ - Gemfile
100
+ - LICENSE
101
+ - NOTICE.TXT
102
+ - README.md
103
+ - docs/index.asciidoc
104
+ - lib/logstash/outputs/solr_http.rb
105
+ - logstash-output-custom_solr_http.gemspec
106
+ - spec/outputs/solr_http_spec.rb
107
+ homepage: http://www.elastic.co/guide/en/logstash/current/index.html
108
+ licenses:
109
+ - Apache License (2.0)
110
+ metadata:
111
+ logstash_plugin: 'true'
112
+ logstash_group: output
113
+ post_install_message:
114
+ rdoc_options: []
115
+ require_paths:
116
+ - lib
117
+ required_ruby_version: !ruby/object:Gem::Requirement
118
+ requirements:
119
+ - - ">="
120
+ - !ruby/object:Gem::Version
121
+ version: '0'
122
+ required_rubygems_version: !ruby/object:Gem::Requirement
123
+ requirements:
124
+ - - ">="
125
+ - !ruby/object:Gem::Version
126
+ version: '0'
127
+ requirements: []
128
+ rubyforge_project:
129
+ rubygems_version: 2.6.13
130
+ signing_key:
131
+ specification_version: 4
132
+ summary: Stores and indexes logs in Solr
133
+ test_files:
134
+ - spec/outputs/solr_http_spec.rb