fluent-plugin-elb-log 0.5.0 → 0.6.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 788c19cecdb93f06c99cfbce2d24dbe47643b0f8
4
- data.tar.gz: 6324d059ad408c092b6dd6654443e890f74bc474
3
+ metadata.gz: d27df0130d6510caf02deafc2c329480ec516f77
4
+ data.tar.gz: d3c48121cfa1252092e04db635115b9bba080d6d
5
5
  SHA512:
6
- metadata.gz: 28bbd93a03f59e83f605fd15dd0519e837214660ae4a6b8d91ada544deb7a55aef459ffd3ff64d57e2ccd89253d0904a3888d8d4440981fce60ba4ed6c48b182
7
- data.tar.gz: e7954718e548d01487eb1668a506dd6349bf9a220e934c61f975adbbe7e776292428c5eeca52d6637d4eabed1c4192a800271fcd18b393f39572cfb4de1a38bd
6
+ metadata.gz: a5927766cae842616a2bcf037617a3b63fc1bad7169c3a116d5b966e7f4b85beb174d47cbe64409f57b71e0ca2240d3cd10cb0879dbc603079b5c937aae40798
7
+ data.tar.gz: 5d5b7f8c60d2cd5e0f029c7ce9cb80f41e1880a10f01c75a04d37fad2f341d79785da49ff6d396ec5157c0d68f0438bcc295a5cd3cd38abba1a13531d66470ef
data/README.md CHANGED
@@ -56,6 +56,7 @@ SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt (If you using amazon linux)
56
56
  buf_file <buffer file path>
57
57
  refresh_interval <interval number by second>
58
58
  tag <tag name(default: elb.access)>
59
+ delete <boolean delete processed log files from S3(default: false)>
59
60
 
60
61
  # following attibutes are required if you don't use IAM Role
61
62
  access_key_id <access_key>
@@ -74,6 +75,7 @@ SSL_CERT_FILE=/etc/ssl/certs/ca-bundle.crt (If you using amazon linux)
74
75
  buf_file /tmp/fluentd-elblog.tmpfile
75
76
  refresh_interval 300
76
77
  tag elb.access
78
+ delete false
77
79
  access_key_id XXXXXXXXXXXXXXXXXXXX
78
80
  secret_access_key xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
79
81
  </source>
@@ -4,7 +4,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
4
 
5
5
  Gem::Specification.new do |spec|
6
6
  spec.name = "fluent-plugin-elb-log"
7
- spec.version = "0.5.0"
7
+ spec.version = "0.6.0"
8
8
  spec.authors = ["shinsaka"]
9
9
  spec.email = ["shinx1265@gmail.com"]
10
10
  spec.summary = "Amazon ELB log input plugin"
@@ -24,6 +24,7 @@ class Fluent::Plugin::Elb_LogInput < Fluent::Plugin::Input
24
24
  config_param :buf_file, :string, default: './fluentd_elb_log_buf_file'
25
25
  config_param :http_proxy, :string, default: nil
26
26
  config_param :start_time, :string, default: nil
27
+ config_param :delete, :bool, default: false
27
28
 
28
29
  def configure(conf)
29
30
  super
@@ -145,6 +146,10 @@ class Fluent::Plugin::Elb_LogInput < Fluent::Plugin::Input
145
146
  emit_lines_from_buffer_file(record_common)
146
147
 
147
148
  put_timestamp_file(object_key[:s3_last_modified_unixtime])
149
+
150
+ if @delete
151
+ delete_file_from_s3(object_key[:key])
152
+ end
148
153
  end
149
154
  end
150
155
 
@@ -262,6 +267,16 @@ class Fluent::Plugin::Elb_LogInput < Fluent::Plugin::Input
262
267
  end
263
268
  end
264
269
 
270
+ def delete_file_from_s3(object_name)
271
+ begin
272
+ log.debug "deleting object from s3 name is #{object_name}"
273
+
274
+ s3_client.delete_object(bucket: @s3_bucketname, key: object_name)
275
+ rescue => e
276
+ log.warn "error occurred: #{e.message}, #{e.backtrace}"
277
+ end
278
+ end
279
+
265
280
  def emit_lines_from_buffer_file(record_common)
266
281
  begin
267
282
  # emit per line
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-elb-log
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.5.0
4
+ version: 0.6.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - shinsaka
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-02-02 00:00:00.000000000 Z
11
+ date: 2018-03-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd