fluent-plugin-barito 0.3.3 → 0.3.5

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
  SHA256:
3
- metadata.gz: ecf8a3646e7930f83602324b333be4399b4995455f061fa92c4a059b7e054c1d
4
- data.tar.gz: f0abcd3652ba0ddbe029f59ed24332a87102bb2971a017577332418df60a9ffd
3
+ metadata.gz: 9e4c37eded53d571e098bfbe5b12df7d823711e420229facc6215bfa06f86386
4
+ data.tar.gz: dc1960dd6c13a8dfb765d8b5ae5275d285e225cc3c02e2ab3ea9e248d805d314
5
5
  SHA512:
6
- metadata.gz: cb971966ecb6feff749865a6cea6c5bdc812bb104fe2a6fa8a99aebf0711dae35268dd9066ffe1206794322484611351a47989b022a88e54648d1c84e947448c
7
- data.tar.gz: a54188a399d3958707511c178b0555b24102965f181e39e0d421f8498532a2ff3ff39cfd76a101a6f7c6245725fdffaecf1317d50393af5374953c349ae0c95e
6
+ metadata.gz: 88db76d4b14e5eab54266cb19a8c217bf9ca704bdca9030aa4f5d151ad2c1ed288875caec7518a197375b2906c201d81b57149f0160c1587fe42de67daf684bf
7
+ data.tar.gz: 4ceb45b8e712e9d27c929ae2eaa139bc10ef334879aadcaa438ac692b4d157cd7f6c75c659f03468312ea541a80f7451641f58f41cb4cfac40cd5de342358fbc
data/CHANGELOG.md CHANGED
@@ -1,5 +1,13 @@
1
1
  # Changelog
2
2
 
3
+ **0.3.5**
4
+
5
+ - Add gzip/compressed feature before sent timber
6
+
7
+ **0.3.4**
8
+
9
+ - Add cluster name field (from k8s)
10
+
3
11
  **0.3.3**
4
12
 
5
13
  - Print verbose error on logs when receiving failed response from the server
data/README.md CHANGED
@@ -64,30 +64,32 @@ Use type `barito_vm` for deployment without kubernetes
64
64
  ```
65
65
 
66
66
  ## With Kubernetes
67
- Change type to `barito_k8s`.
67
+ Change type to `barito_batch_k8s`.
68
68
 
69
69
  ```
70
- <match barito>
71
- @type barito_k8s
72
-
73
- use_https false
70
+ <match kubernetes.var.log.containers.server-**.log>
71
+ @type barito_batch_k8s
72
+ name test_container
73
+ cluster_name test_cluster
74
+ application_name test_application_name
75
+ application_group_secret xxxxxx
76
+ produce_url https://router.barito/produce_batch
77
+ <buffer>
78
+ flush_at_shutdown false
79
+ flush_thread_count 8
80
+ flush_thread_interval 1
81
+ flush_thread_burst_interval 1
82
+ flush_mode interval
83
+ flush_interval 1s
84
+ queued_chunks_limit_size 1
85
+ overflow_action drop_oldest_chunk
86
+ retry_timeout 0s
87
+ retry_max_times 0
88
+ disable_chunk_backup true
89
+ </buffer>
74
90
  </match>
75
91
  ```
76
92
 
77
- and set `kubernetes labels` in YAML :
78
-
79
- ```
80
- labels:
81
- baritoApplicationSecret: "ABCDE1234"
82
- baritoProduceHost: "receiver-host"
83
- baritoProducePort: "receiver-port"
84
- baritoProduceTopic: "some-topic"
85
- baritoStreamId: "1"
86
- baritoStoreId: "2"
87
- baritoForwarderId: "3"
88
- baritoClientId: "4"
89
- ```
90
-
91
93
  ## Copyright
92
94
 
93
95
  * Copyright(c) 2018- BaritoLog
@@ -3,7 +3,7 @@ $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
3
3
 
4
4
  Gem::Specification.new do |spec|
5
5
  spec.name = "fluent-plugin-barito"
6
- spec.version = "0.3.3"
6
+ spec.version = "0.3.5"
7
7
  spec.authors = ["BaritoLog"]
8
8
  spec.email = ["pushm0v.development@gmail.com", "iman.tung@gmail.com"]
9
9
 
@@ -1,4 +1,5 @@
1
1
  require 'rest-client'
2
+ require 'zlib'
2
3
 
3
4
  class Fluent::Plugin::BaritoTransport
4
5
 
@@ -17,4 +18,16 @@ class Fluent::Plugin::BaritoTransport
17
18
  end
18
19
  end
19
20
 
21
+ def send_compressed(timber, header)
22
+ begin
23
+ header['Content-Encoding'] = 'gzip'
24
+
25
+ gz = Zlib::GzipWriter.new(StringIO.new)
26
+ gz << timber.to_json
27
+ RestClient.post @produce_url, gz.close.string, header
28
+ rescue Exception => e
29
+ puts(header)
30
+ @logger.error [e.message, e.response, Hash[header.collect{|k,v| [k.to_s, v]}]].join(', ')
31
+ end
32
+ end
20
33
  end
@@ -14,6 +14,7 @@ module Fluent
14
14
  config_param :application_group_secret, :string, :default => nil
15
15
  config_param :application_name, :string, :default => nil
16
16
  config_param :produce_url, :string, :default => ''
17
+ config_param :cluster_name, :string, :default => ''
17
18
 
18
19
  # Overide from BufferedOutput
19
20
  def start
@@ -47,7 +48,8 @@ module Fluent
47
48
  'pod_name' => k8s_metadata['pod_name'],
48
49
  'namespace_name' => k8s_metadata['namespace_name'],
49
50
  'container_name' => k8s_metadata['container_name'],
50
- 'host' => k8s_metadata['host']
51
+ 'host' => k8s_metadata['host'],
52
+ 'cluster_name' => @cluster_name
51
53
  }
52
54
 
53
55
  data['items'] << new_timber
@@ -64,7 +66,7 @@ module Fluent
64
66
  header = {content_type: :json, 'X-App-Secret' => @application_secret}
65
67
  end
66
68
 
67
- transport.send(data, header)
69
+ transport.send_compressed(data, header)
68
70
  end
69
71
 
70
72
  def clean_attribute(record)
@@ -49,7 +49,7 @@ module Fluent
49
49
  header = {content_type: :json, 'X-App-Secret' => @application_secret}
50
50
  end
51
51
 
52
- transport.send(data, header)
52
+ transport.send_compressed(data, header)
53
53
  end
54
54
  end
55
55
  end
@@ -42,7 +42,7 @@ module Fluent
42
42
  else
43
43
  header = {content_type: :json, 'X-App-Secret' => @application_secret}
44
44
  end
45
- transport.send(timber, header)
45
+ transport.send_compressed(timber, header)
46
46
  end
47
47
  end
48
48
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-barito
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.3.3
4
+ version: 0.3.5
5
5
  platform: ruby
6
6
  authors:
7
7
  - BaritoLog
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2018-11-13 00:00:00.000000000 Z
11
+ date: 2023-05-16 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -126,22 +126,22 @@ dependencies:
126
126
  name: fluentd
127
127
  requirement: !ruby/object:Gem::Requirement
128
128
  requirements:
129
- - - "~>"
130
- - !ruby/object:Gem::Version
131
- version: '0.12'
132
129
  - - ">="
133
130
  - !ruby/object:Gem::Version
134
131
  version: 0.12.0
132
+ - - "~>"
133
+ - !ruby/object:Gem::Version
134
+ version: '0.12'
135
135
  type: :runtime
136
136
  prerelease: false
137
137
  version_requirements: !ruby/object:Gem::Requirement
138
138
  requirements:
139
- - - "~>"
140
- - !ruby/object:Gem::Version
141
- version: '0.12'
142
139
  - - ">="
143
140
  - !ruby/object:Gem::Version
144
141
  version: 0.12.0
142
+ - - "~>"
143
+ - !ruby/object:Gem::Version
144
+ version: '0.12'
145
145
  - !ruby/object:Gem::Dependency
146
146
  name: rest-client
147
147
  requirement: !ruby/object:Gem::Requirement
@@ -205,8 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
205
205
  - !ruby/object:Gem::Version
206
206
  version: '0'
207
207
  requirements: []
208
- rubyforge_project:
209
- rubygems_version: 2.7.7
208
+ rubygems_version: 3.0.3.1
210
209
  signing_key:
211
210
  specification_version: 4
212
211
  summary: Fluentd output plugin for BaritoLog