fluent-plugin-cloudwatch-ingest 0.1.46 → 0.1.47

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: 3f5fd91695ebc14cb8b5a649a9a1fd6085742f4d
4
- data.tar.gz: 96c8874ea1660e4f23640aa664d2d144a8067fd0
3
+ metadata.gz: 2346a1b86d48a04d2699c8545dff0ced90e9dbd1
4
+ data.tar.gz: 41936ce91915b943a539254b09a8d741bc2a86f4
5
5
  SHA512:
6
- metadata.gz: 8572bc3c6dc6dcd6ac245a40d5a709ffd32932fc07cccd880be3402e59256e1b4bbeccccf21d8a613d9d8489f3894b43572243a6a283905ed59b7b0ca958e905
7
- data.tar.gz: 156923cc879d36be12f951fae790dff4e6a47bc3f6945a302354570c6f850c2461b4c625d46ebb37bf6a3c2a63491b1561d8a6ac11f6bd2508c5a09e1b64fa28
6
+ metadata.gz: 400d18264d1a31027680d9349210d8542b89a8c18afd4dcc2d653415fc79fd512b98eeea7a77c8b910b2aeab94c30abc4d7a76c658489c093dc77c98cb35ef0c
7
+ data.tar.gz: c7b81e7ca951b2c7fda0ae4fecd98e9203dd85699a40786a6c67031c20e4d640a1e83051494a1dba2ffa8f87b2098a259d40fe632f8b6746ad267b358e292040
data/README.md CHANGED
@@ -44,7 +44,10 @@ Or install it yourself as:
44
44
  <parse>
45
45
  @type cloudwatch_ingest
46
46
  expression /^(?<message>.+)$/
47
- event_time true # Take time from the Cloudwatch event, rather than parse it from the body
47
+ time_format %Y-%m-%d %H:%M:%S.%L
48
+ event_time true # take time from the Cloudwatch event, rather than parse it from the body
49
+ inject_group_name true # inject the group name into the record
50
+ inject_stream_name true # inject the stream name into the record
48
51
  </parse>
49
52
  </source>
50
53
  ```
@@ -2,7 +2,7 @@ module Fluent
2
2
  module Plugin
3
3
  module Cloudwatch
4
4
  module Ingest
5
- VERSION = '0.1.46'.freeze
5
+ VERSION = '0.1.47'.freeze
6
6
  end
7
7
  end
8
8
  end
@@ -34,9 +34,16 @@ module Fluent::Plugin
34
34
  config_param :aws_logging_enabled, :bool, default: false
35
35
  config_section :parse do
36
36
  config_set_default :@type, 'cloudwatch_ingest'
37
- config_set_default :expression, '^(?<message>.+)$'
38
- config_set_default :event_time, true
39
- config_set_default :time_format, '%Y-%m-%d %H:%M:%S.%L'
37
+ desc 'Regular expression with which to parse the event message'
38
+ config_param :expression, :string, default: '^(?<message>.+)$'
39
+ desc 'Take the timestamp from the event rather than the expression'
40
+ config_param :event_time, :bool, default: true
41
+ desc 'Time format to use when parsing event message'
42
+ config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S.%L'
43
+ desc 'Inject the log group name into the record'
44
+ config_param :inject_group_name, :bool, default: true
45
+ desc 'Inject the log stream name into the record'
46
+ config_param :inject_stream_name, :bool, default: true
40
47
  end
41
48
 
42
49
  def initialize
@@ -94,8 +101,8 @@ module Fluent::Plugin
94
101
 
95
102
  private
96
103
 
97
- def emit(event)
98
- @parser.parse(event) do |time, record|
104
+ def emit(event, log_group_name, log_stream_name)
105
+ @parser.parse(event, log_group_name, log_stream_name) do |time, record|
99
106
  router.emit(@tag, time, record)
100
107
  end
101
108
  end
@@ -200,7 +207,7 @@ module Fluent::Plugin
200
207
 
201
208
  response.events.each do |e|
202
209
  begin
203
- emit(e)
210
+ emit(e, group, stream)
204
211
  rescue => boom
205
212
  log.error("Failed to emit event #{e}: #{boom}")
206
213
  end
@@ -6,9 +6,11 @@ module Fluent
6
6
  class CloudwatchIngestParser < RegexpParser
7
7
  Plugin.register_parser('cloudwatch_ingest', self)
8
8
 
9
- config_set_default :expression, '^(?<message>.+)$'
10
- config_set_default :time_format, '%Y-%m-%d %H:%M:%S.%L'
11
- config_set_default :event_time, true
9
+ config_param :expression, :string, default: '^(?<message>.+)$'
10
+ config_param :time_format, :string, default: '%Y-%m-%d %H:%M:%S.%L'
11
+ config_param :event_time, :bool, default: true
12
+ config_param :inject_group_name, :bool, default: true
13
+ config_param :inject_stream_name, :bool, default: true
12
14
 
13
15
  def initiaize
14
16
  super
@@ -18,7 +20,7 @@ module Fluent
18
20
  super
19
21
  end
20
22
 
21
- def parse(event)
23
+ def parse(event, group, stream)
22
24
  time = nil
23
25
  record = nil
24
26
  super(event.message) do |t, r|
@@ -26,6 +28,10 @@ module Fluent
26
28
  record = r
27
29
  end
28
30
 
31
+ # Inject optional fields
32
+ record['log_group_name'] = group if @inject_group_name
33
+ record['log_stream_name'] = stream if @inject_stream_name
34
+
29
35
  # We do String processing on the event time here to
30
36
  # avoid rounding errors introduced by floating point
31
37
  # arithmetic.
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-cloudwatch-ingest
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.46
4
+ version: 0.1.47
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sam Pointer
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-29 00:00:00.000000000 Z
11
+ date: 2017-04-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler