logstash-codec-gzip 2.0.4
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/CHANGELOG.md +16 -0
- data/CONTRIBUTORS +17 -0
- data/Gemfile +2 -0
- data/LICENSE +13 -0
- data/NOTICE.TXT +5 -0
- data/README.md +89 -0
- data/lib/logstash/codecs/gzip.rb +42 -0
- data/logstash-codec-gzip.gemspec +27 -0
- metadata +84 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 1cc6a6074faa368c9c1eac11c06dd06ac27e448a
|
4
|
+
data.tar.gz: dd09655218341496b37d1a8e5cbc6237390ab208
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 92383a43991e429a9b1809a774dea5a8e159b8b33e6d1922c3576ba735d5d3addde2bc9396b01be91d7288de4169907f0032f471d1ee3597d687299018dcc0f3
|
7
|
+
data.tar.gz: a77dbab937da49efa503dc93b50cf92ba4c5783b4afd70722f63b1c562f8dcf0cdb14ba1d0bc63e3bbc9448c5431734313be9f17d28f0b3dc718d5e117f8f754
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
## 2.0.4
|
2
|
+
- Reduce the size of the gem by removing the vendor files
|
3
|
+
|
4
|
+
## 2.0.3
|
5
|
+
- fixed a spec, no change in functionality
|
6
|
+
|
7
|
+
## 2.0.0
|
8
|
+
- Plugins were updated to follow the new shutdown semantic, this mainly allows Logstash to instruct input plugins to terminate gracefully,
|
9
|
+
instead of using Thread.raise on the plugins' threads. Ref: https://github.com/elastic/logstash/pull/3895
|
10
|
+
- Dependency on logstash-core update to 2.0
|
11
|
+
|
12
|
+
## 1.1.0
|
13
|
+
- Handle scalar types (string/number) and be more defensive about crashable errors
|
14
|
+
|
15
|
+
## 1.0.1
|
16
|
+
- Handle JSON arrays at source root by emitting multiple events
|
data/CONTRIBUTORS
ADDED
@@ -0,0 +1,17 @@
|
|
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
|
+
* Colin Surprenant (colinsurprenant)
|
6
|
+
* Jordan Sissel (jordansissel)
|
7
|
+
* João Duarte (jsvd)
|
8
|
+
* Kurt Hurtado (kurtado)
|
9
|
+
* Nick Ethier (nickethier)
|
10
|
+
* Pier-Hugues Pellerin (ph)
|
11
|
+
* Richard Pijnenburg (electrical)
|
12
|
+
* Tal Levy (talevy)
|
13
|
+
|
14
|
+
Note: If you've sent us patches, bug reports, or otherwise contributed to
|
15
|
+
Logstash, and you aren't on the list above and want to be, please let us know
|
16
|
+
and we'll make sure you're here. Contributions from folks like you are what make
|
17
|
+
open source awesome.
|
data/Gemfile
ADDED
data/LICENSE
ADDED
@@ -0,0 +1,13 @@
|
|
1
|
+
Copyright (c) 2012–2015 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.
|
data/NOTICE.TXT
ADDED
data/README.md
ADDED
@@ -0,0 +1,89 @@
|
|
1
|
+
# Logstash Plugin
|
2
|
+
|
3
|
+
[![Build
|
4
|
+
Status](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Codecs/job/logstash-plugin-codec-json-unit/badge/icon)](http://build-eu-00.elastic.co/view/LS%20Plugins/view/LS%20Codecs/job/logstash-plugin-codec-json-unit/)
|
5
|
+
|
6
|
+
This is a plugin for [Logstash](https://github.com/elastic/logstash).
|
7
|
+
|
8
|
+
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.
|
9
|
+
|
10
|
+
## Documentation
|
11
|
+
|
12
|
+
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/).
|
13
|
+
|
14
|
+
- For formatting code or config example, you can use the asciidoc `[source,ruby]` directive
|
15
|
+
- For more asciidoc formatting tips, see the excellent reference here https://github.com/elastic/docs#asciidoc-guide
|
16
|
+
|
17
|
+
## Need Help?
|
18
|
+
|
19
|
+
Need help? Try #logstash on freenode IRC or the https://discuss.elastic.co/c/logstash discussion forum.
|
20
|
+
|
21
|
+
## Developing
|
22
|
+
|
23
|
+
### 1. Plugin Developement and Testing
|
24
|
+
|
25
|
+
#### Code
|
26
|
+
- To get started, you'll need JRuby with the Bundler gem installed.
|
27
|
+
|
28
|
+
- 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).
|
29
|
+
|
30
|
+
- Install dependencies
|
31
|
+
```sh
|
32
|
+
bundle install
|
33
|
+
```
|
34
|
+
|
35
|
+
#### Test
|
36
|
+
|
37
|
+
- Update your dependencies
|
38
|
+
|
39
|
+
```sh
|
40
|
+
bundle install
|
41
|
+
```
|
42
|
+
|
43
|
+
- Run tests
|
44
|
+
|
45
|
+
```sh
|
46
|
+
bundle exec rspec
|
47
|
+
```
|
48
|
+
|
49
|
+
### 2. Running your unpublished Plugin in Logstash
|
50
|
+
|
51
|
+
#### 2.1 Run in a local Logstash clone
|
52
|
+
|
53
|
+
- Edit Logstash `Gemfile` and add the local plugin path, for example:
|
54
|
+
```ruby
|
55
|
+
gem "logstash-filter-awesome", :path => "/your/local/logstash-filter-awesome"
|
56
|
+
```
|
57
|
+
- Install plugin
|
58
|
+
```sh
|
59
|
+
bin/plugin install --no-verify
|
60
|
+
```
|
61
|
+
- Run Logstash with your plugin
|
62
|
+
```sh
|
63
|
+
bin/logstash -e 'filter {awesome {}}'
|
64
|
+
```
|
65
|
+
At this point any modifications to the plugin code will be applied to this local Logstash setup. After modifying the plugin, simply rerun Logstash.
|
66
|
+
|
67
|
+
#### 2.2 Run in an installed Logstash
|
68
|
+
|
69
|
+
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:
|
70
|
+
|
71
|
+
- Build your plugin gem
|
72
|
+
```sh
|
73
|
+
gem build logstash-filter-awesome.gemspec
|
74
|
+
```
|
75
|
+
- Install the plugin from the Logstash home
|
76
|
+
```sh
|
77
|
+
bin/plugin install /your/local/plugin/logstash-filter-awesome.gem
|
78
|
+
```
|
79
|
+
- Start Logstash and proceed to test the plugin
|
80
|
+
|
81
|
+
## Contributing
|
82
|
+
|
83
|
+
All contributions are welcome: ideas, patches, documentation, bug reports, complaints, and even something you drew up on a napkin.
|
84
|
+
|
85
|
+
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.
|
86
|
+
|
87
|
+
It is more important to the community that you are able to contribute.
|
88
|
+
|
89
|
+
For more information about contributing, see the [CONTRIBUTING](https://github.com/elastic/logstash/blob/master/CONTRIBUTING.md) file.
|
@@ -0,0 +1,42 @@
|
|
1
|
+
# encoding: utf-8
|
2
|
+
require "logstash/codecs/base"
|
3
|
+
require "logstash/util/charset"
|
4
|
+
require "zlib"
|
5
|
+
require "stringio"
|
6
|
+
|
7
|
+
# This codec may be used to decode gzip data from string.
|
8
|
+
#
|
9
|
+
# If this codec recieves a payload from an input that is not valid GZIP, then
|
10
|
+
# it will fall back to plain text and add a tag `_gzipparsefailure`. Upon a GZIP
|
11
|
+
# failure, the payload will be stored in the `message` field.
|
12
|
+
class LogStash::Codecs::GZIP < LogStash::Codecs::Base
|
13
|
+
config_name "gzip"
|
14
|
+
|
15
|
+
# The character encoding used in this codec. Examples include "UTF-8" and
|
16
|
+
# "CP1252".
|
17
|
+
#
|
18
|
+
# GZIP requires valid UTF-8 strings, but in some cases, software that
|
19
|
+
# emits GZIP does so in another encoding (nxlog, for example). In
|
20
|
+
# weird cases like this, you can set the `charset` setting to the
|
21
|
+
# actual encoding of the text and Logstash will convert it for you.
|
22
|
+
#
|
23
|
+
# For nxlog users, you may to set this to "CP1252".
|
24
|
+
config :charset, :validate => ::Encoding.name_list, :default => "UTF-8"
|
25
|
+
|
26
|
+
public
|
27
|
+
def register
|
28
|
+
@converter = LogStash::Util::Charset.new(@charset)
|
29
|
+
@converter.logger = @logger
|
30
|
+
end
|
31
|
+
|
32
|
+
public
|
33
|
+
def decode(data)
|
34
|
+
begin
|
35
|
+
decoded = Zlib::GzipReader.new(StringIO.new(data)).read
|
36
|
+
yield LogStash::Event.new("message" => @converter.convert(decoded))
|
37
|
+
rescue Zlib::Error, Zlib::GzipFile::Error=> e
|
38
|
+
@logger.info? && @logger.info("GZIP parse failure. Falling back to plain-text", :error => e, :data => data)
|
39
|
+
yield LogStash::Event.new("message" => data, "tags" => ["_gzipparsefailure"])
|
40
|
+
end
|
41
|
+
end # def decode
|
42
|
+
end # class LogStash::Codecs::JSON
|
@@ -0,0 +1,27 @@
|
|
1
|
+
Gem::Specification.new do |s|
|
2
|
+
|
3
|
+
s.name = 'logstash-codec-gzip'
|
4
|
+
s.version = '2.0.4'
|
5
|
+
s.licenses = ['Apache License (2.0)']
|
6
|
+
s.summary = "This codec may be used to decode (via inputs) and encode (via outputs) full gzip messages"
|
7
|
+
s.description = "This gem is a logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/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/**/*','vendor/**/*','*.gemspec','*.md','CONTRIBUTORS','Gemfile','LICENSE','NOTICE.TXT']
|
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" => "codec" }
|
21
|
+
|
22
|
+
# Gem dependencies
|
23
|
+
s.add_runtime_dependency "logstash-core", "< 2.0.0"
|
24
|
+
|
25
|
+
s.add_development_dependency 'logstash-devutils'
|
26
|
+
end
|
27
|
+
|
metadata
ADDED
@@ -0,0 +1,84 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: logstash-codec-gzip
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 2.0.4
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Elastic
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2018-10-24 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: logstash-core
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - <
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: 2.0.0
|
20
|
+
type: :runtime
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - <
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: 2.0.0
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: logstash-devutils
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - '>='
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - '>='
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '0'
|
41
|
+
description: This gem is a logstash plugin required to be installed on top of the
|
42
|
+
Logstash core pipeline using $LS_HOME/bin/plugin install gemname. This gem is not
|
43
|
+
a stand-alone program
|
44
|
+
email: info@elastic.co
|
45
|
+
executables: []
|
46
|
+
extensions: []
|
47
|
+
extra_rdoc_files: []
|
48
|
+
files:
|
49
|
+
- lib/logstash/codecs/gzip.rb
|
50
|
+
- logstash-codec-gzip.gemspec
|
51
|
+
- CHANGELOG.md
|
52
|
+
- README.md
|
53
|
+
- CONTRIBUTORS
|
54
|
+
- Gemfile
|
55
|
+
- LICENSE
|
56
|
+
- NOTICE.TXT
|
57
|
+
homepage: http://www.elastic.co/guide/en/logstash/current/index.html
|
58
|
+
licenses:
|
59
|
+
- Apache License (2.0)
|
60
|
+
metadata:
|
61
|
+
logstash_plugin: 'true'
|
62
|
+
logstash_group: codec
|
63
|
+
post_install_message:
|
64
|
+
rdoc_options: []
|
65
|
+
require_paths:
|
66
|
+
- lib
|
67
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
68
|
+
requirements:
|
69
|
+
- - '>='
|
70
|
+
- !ruby/object:Gem::Version
|
71
|
+
version: '0'
|
72
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
73
|
+
requirements:
|
74
|
+
- - '>='
|
75
|
+
- !ruby/object:Gem::Version
|
76
|
+
version: '0'
|
77
|
+
requirements: []
|
78
|
+
rubyforge_project:
|
79
|
+
rubygems_version: 2.0.14.1
|
80
|
+
signing_key:
|
81
|
+
specification_version: 4
|
82
|
+
summary: This codec may be used to decode (via inputs) and encode (via outputs) full
|
83
|
+
gzip messages
|
84
|
+
test_files: []
|