fluent-plugin-ecs-filter 0.1.0 → 0.1.1

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,15 +1,15 @@
1
1
  ---
2
2
  !binary "U0hBMQ==":
3
3
  metadata.gz: !binary |-
4
- ZWM4ZTNjMDFjZTg1OTAxNDg0YjQ4MmE3ZDJiYTgyYjUyYWFkYzNlOA==
4
+ NjlmYzBiMzUyMGIzM2U4NWNhZTc2NjcyOGQ4ZTg4ZjUyZWYwMzUxYQ==
5
5
  data.tar.gz: !binary |-
6
- YzczZjYwZjNkYjEyYjUzMDM5YzljNThmODNlMjVjOTdjMDhlYTk2ZA==
6
+ YTZhZmRlZjllZGU2ODg5YzkwOTU5Y2Y4MjkxNWI2NzhhY2EzNWViZg==
7
7
  SHA512:
8
8
  metadata.gz: !binary |-
9
- NDhiZjVhM2NhMGQwZjljNzFhNzA3YTE2YjllYTdiYmNiZTIyMTU5MGFlY2I5
10
- MjkzZjM2NTgwNDk5MWU4MTU3MTIwZDMzNTFhMzIzNDVjOGY0NDRjMjAzNGM1
11
- NWQ1NzE1ZTQ1N2M0ZGIyNTlhZTM1MTdmZmYxZTBlMDAyYjVlM2U=
9
+ YTRkYjFkYjhjMTU0MDk3NjYyYzJlYjM5MWNkOTc2NWIyOGU4ZTQ4YjVkZmQy
10
+ NGU0NjcwZWQzNTY5NWNhZDU1NTRiMjExMjNjNDZhMWViY2MzZTc1NzYzZWI1
11
+ MTQyYWQ5NjU1YzQxOTdlZWQ1NjY5YWY4Y2JhNGQ0NWFlZjJlMjY=
12
12
  data.tar.gz: !binary |-
13
- OWVhMWM3MDJiNWIzZWYzYmJkNzFmM2VlYTUxYzliNmVkYzk3MGIwM2IyMzVj
14
- ZjU5ODMyY2VjMGRjMGI4N2FmYTJhMTlmMjcwOWI3OWRiNjg2ODI1ZDdhODU1
15
- NmNhMjIyY2M2NDk3NzE2MmMwMzVjNTE1NTI5ZDc4YjcxYTg5ZWQ=
13
+ MWE1OWY4ZTBlYTZlNDE3N2Y0OGE0OWMzYWM5YmY0YjNkN2RiMWI0MjMyZDJi
14
+ NDdjZmJkZDU0Yjc3OWY2YWZjZWFhMmRmY2JjZWRlYWRjMGIwYzJhMTkwMzU4
15
+ MDQ1NTNjNTEyZTc5YjRkOGFiYmY4YTY5ZjUwODYyYWRjZThmM2Y=
data/README.md CHANGED
@@ -3,7 +3,7 @@
3
3
  [![Test Coverage](https://codeclimate.com/github/joshughes/fluent-plugin-ecs-filter/badges/coverage.svg)](https://codeclimate.com/github/joshughes/fluent-plugin-ecs-filter/coverage)
4
4
  [![Gem Version](https://badge.fury.io/rb/fluent-plugin-ecs-filter.svg)](https://badge.fury.io/rb/fluent-plugin-ecs-filter)
5
5
  [![Inline docs](http://inch-ci.org/github/joshughes/fluent-plugin-ecs-filter.svg?branch=master)](http://inch-ci.org/github/joshughes/fluent-plugin-ecs-filter)
6
- [![Dependency Status](https://www.versioneye.com/user/projects/5658d10aaef3b5003e000000/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5658d10aaef3b5003e000000)
6
+ [![Dependency Status](https://www.versioneye.com/user/projects/5748a0dace8d0e004505f7cd/badge.svg?style=flat)](https://www.versioneye.com/user/projects/5748a0dace8d0e004505f7cd)
7
7
 
8
8
  Marathon, Chronos and Mesos combined can allow for teams to build a great solution for deploying and scaling containers. The issue is when you have a system like Kibana it can be hard to identify what container or task a log is coming from.
9
9
 
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |gem|
6
6
  gem.name = 'fluent-plugin-ecs-filter'
7
- gem.version = '0.1.0'
7
+ gem.version = '0.1.1'
8
8
  gem.authors = ['Joseph Hughes']
9
9
  gem.email = ['jjhughes57@gmail.com']
10
10
  gem.description = 'Filter plugin to add AWS ECS metadata'
@@ -24,7 +24,7 @@ module Fluent
24
24
  config_param :cache_size, :integer, default: 1000
25
25
  config_param :cache_ttl, :integer, default: 60 * 60
26
26
  config_param :container_id_attr, :string, default: 'container_id'
27
-
27
+ config_param :task_family_prepend, :string, default: nil
28
28
  config_param :merge_json_log, :bool, default: true
29
29
 
30
30
  # Get the configuration for the plugin
@@ -39,7 +39,6 @@ module Fluent
39
39
  @cache_ttl = :none if @cache_ttl < 0
40
40
 
41
41
  @cache = LruRedux::TTL::ThreadSafeCache.new(@cache_size, @cache_ttl)
42
-
43
42
  end
44
43
 
45
44
  # Gets the log event stream and moifies it. This is where the plugin hooks
@@ -98,6 +97,7 @@ module Fluent
98
97
  if container
99
98
  labels = container.json['Config']['Labels']
100
99
  task_data['task_family'] = labels['com.amazonaws.ecs.task-definition-family']
100
+ task_data['task_family'].prepend(@task_family_prepend) if @task_family_prepend
101
101
  task_data['task_version'] = labels['com.amazonaws.ecs.task-definition-version']
102
102
  task_data['task_id'] = labels['com.amazonaws.ecs.task-arn'].split('/').last
103
103
  end
@@ -25,6 +25,9 @@ class ECSFilterTest < Test::Unit::TestCase
25
25
  get_container_id_tag true
26
26
  container_id_attr container_id
27
27
  ]
28
+ CONFIG4 = %[
29
+ task_family_prepend foo-
30
+ ]
28
31
 
29
32
  def create_driver(conf = CONFIG, tag = 'test')
30
33
  Fluent::Test::FilterTestDriver.new(Fluent::ECSFilter, tag).configure(conf)
@@ -60,6 +63,20 @@ class ECSFilterTest < Test::Unit::TestCase
60
63
  assert_equal task_id, log_entry['task_id']
61
64
  end
62
65
 
66
+ def test_task_family_prepend
67
+ setup_ecs_container('foobar123', 'ecs')
68
+
69
+ d1 = create_driver(CONFIG4, 'docker.foobar123')
70
+ d1.run do
71
+ d1.filter('log' => 'Hello World 1')
72
+ end
73
+ filtered = d1.filtered_as_array
74
+
75
+ log_entry = filtered[0][2]
76
+
77
+ assert_equal 'foo-unifi-video', log_entry['task_family']
78
+ end
79
+
63
80
  def test_container_cache
64
81
  setup_ecs_container('foobar123', 'ecs')
65
82
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-ecs-filter
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Joseph Hughes
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-05-27 00:00:00.000000000 Z
11
+ date: 2016-05-31 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd