logstash-filter-docker_metadata 0.1.3 → 0.1.4

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: d37853fad6b429426f7b2d0501f260336824ae7a
4
- data.tar.gz: 1a73e1cffb24ced76ea68f8861d470fdb0ec0cce
3
+ metadata.gz: 000be01a06b8f7d60099cf0b4fb958cc8f4f1620
4
+ data.tar.gz: 36332effcda2cd70d8d404b1066d1d6346a337ae
5
5
  SHA512:
6
- metadata.gz: 4f8dab41edbe9427f367a9b709ea4537aed950c21e4cb363563c90fc0a9ebf18efd7271faf116519f04f448bdda7146f3e946c52899c5aea460c6acf6b2e778c
7
- data.tar.gz: 8f132172396fa9a5d367d5e72ca93025480875131e87df499dd81a88ba8965797bb396f06d40fc451fe392ec33c44f1d36428471faca5de3d9b7fc12dfac502a
6
+ metadata.gz: 926be3f80c06cf3d560775bc4122e62c52de798328931233b38f68f6f04a98d1bbdf53b1eae860806ff6f054a1d20c5e7050feb9b02cef9a5716558bad68a374
7
+ data.tar.gz: 8f906e5bb6ab7c8e9db7d3069cd8248f7d5918d09824ea727fbc7b50260cb7985e0f508d7ecb1fb4abc05cbd036bb8630fd9c987992da80748d3f420dc5fe7f2
data/README.md CHANGED
@@ -1,3 +1,5 @@
1
+ [![Gem Version](https://badge.fury.io/rb/logstash-filter-docker_metadata.svg)](http://badge.fury.io/rb/logstash-filter-docker_metadata)
2
+
1
3
  # Logstash Plugin
2
4
 
3
5
  This is a plugin for [Logstash](https://github.com/elasticsearch/logstash).
@@ -56,7 +58,8 @@ Logstash output :
56
58
 
57
59
  | name | default value | comment |
58
60
  | :------------- | :------------- | :------------- |
59
- | `docker_url` | `unix:///var/run/docker.sock` | make sure it match where you mount the docker socket |
61
+ | `docker_url` | `'unix:///var/run/docker.sock'` | make sure it match where you mount the docker socket |
62
+ | `field_docker_id` | `'path'` | The field from which you read the docker ID |
60
63
  | `container_id_regexp` | `(\w{64})` | match the complete Id of a docker container |
61
64
  | `cache_size` | 100 | |
62
65
 
@@ -126,4 +129,4 @@ It is more important to the community that you are able to contribute.
126
129
  For more information about contributing, see the [CONTRIBUTING](https://github.com/elasticsearch/logstash/blob/master/CONTRIBUTING.md) file.
127
130
 
128
131
  ## Licence
129
- 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.
132
+ 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.
@@ -2,7 +2,6 @@
2
2
  PWD=$(pwd)
3
3
  docker run -ti \
4
4
  -v $PWD:/tmp/logstash-filter \
5
- -v /var/lib/docker/containers:/logs/docker \
6
5
  -v $PWD/setup.sh:/usr/local/bin/setupPlugin \
7
6
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
8
7
  logstash bash
@@ -20,6 +20,12 @@ class LogStash::Filters::DockerMetadata < LogStash::Filters::Base
20
20
  :required => false,
21
21
  :deprecated => false
22
22
 
23
+ config :field_docker_id,
24
+ :validate => :string,
25
+ :default => 'path',
26
+ :required => false,
27
+ :deprecated => false
28
+
23
29
  config :cache_size,
24
30
  :validate => :number,
25
31
  :default => 100,
@@ -63,17 +69,11 @@ class LogStash::Filters::DockerMetadata < LogStash::Filters::Base
63
69
  public
64
70
  def filter(event)
65
71
 
66
- # get container id from path field
67
- if event["path"]
68
- container_id = event["path"].match(@container_id_regexp_compiled)
72
+ # get container id from @field_docker_id field
73
+ if event[@field_docker_id]
74
+ container_id = event[@field_docker_id].match(@container_id_regexp_compiled)
69
75
  end
70
76
 
71
- # if it failed fall back to message field
72
- if !container_id || !container_id[0]
73
- if event["message"]
74
- container_id = event["message"].match(@container_id_regexp_compiled)
75
- end
76
- end
77
77
 
78
78
  if container_id && container_id[0]
79
79
  container_id = container_id[0]
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-filter-docker_metadata'
3
- s.version = '0.1.3'
3
+ s.version = '0.1.4'
4
4
  s.licenses = ['Apache License (2.0)']
5
5
  s.summary = "This filter add docker metadata to messages that contain a docker ID. It's heavily inspired from https://github.com/fabric8io/fluent-plugin-docker_metadata_filter."
6
6
  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"
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-filter-docker_metadata
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.3
4
+ version: 0.1.4
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic