logstash-output-edge_loki 1.0.5 → 1.0.7

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
  SHA256:
3
- metadata.gz: 566d8ecb5467df002d8472b81050203bf545b61bab5d62eee95e97360515d99d
4
- data.tar.gz: 404c178ce114082bf0c345f238cad7ea956d78f210d8928747aee4c9a4f1140f
3
+ metadata.gz: b7815895543bbcb18b5a4b9383f083223f229713c537f336f48cc2cffd76fed7
4
+ data.tar.gz: d8d68d9291a738b47d4de30ec1d3c2a62894aae498dfb6869e14684d4cbebb37
5
5
  SHA512:
6
- metadata.gz: 189f31a68e1791ad9dce43de4cb9a5106ae95a8b20bfd63ae9dbf867f241eea7c78d6511eee90684850aa06ca9dc41fbdb75293e77f6ea48093f7e40734a4693
7
- data.tar.gz: 4c041143bb13e7c0466311f01b01f98ef796e80900091d9170857928aa0298f305b3cdfdeae14095b35663255f563c456f17799943ce1837482765e1cb806334
6
+ metadata.gz: 4baf39cedf6a80af43190b002452d7565e1e1277de335aa708fd0533f76a527250ec90c420b1a643f7adf4c61d9dfe3216d9df4c10217aa926b126e703b504b1
7
+ data.tar.gz: 7fc3f6ad11def007015b2180ed15c663919babce9f36d5e69d1533751f2ebbf78325f8fb949c7f92c8cf90aadc072e428f478cbc8f8dc8c6e37592072f93aebe
@@ -224,9 +224,9 @@ class LogStash::Outputs::EDGE_Loki < LogStash::Outputs::Base
224
224
 
225
225
  def send(batch)
226
226
  @logger.info("send: started method")
227
- createClient()
227
+ client = createClient()
228
228
  payload = batch.to_json
229
- res = loki_http_request(payload)
229
+ res = loki_http_request(client, payload)
230
230
  if res.is_a?(Net::HTTPSuccess)
231
231
  @logger.debug("Successfully pushed data to loki")
232
232
  else
@@ -234,25 +234,25 @@ class LogStash::Outputs::EDGE_Loki < LogStash::Outputs::Base
234
234
  end
235
235
  end
236
236
 
237
- def loki_http_request(payload)
237
+ def loki_http_request(client, payload)
238
238
  @logger.info("loki_http_request: started method")
239
239
  req = Net::HTTP::Post.new(
240
240
  @uri.request_uri
241
241
  )
242
- req.add_field('Content-Type', 'application/json')
243
- req.add_field('X-Scope-OrgID', @tenant_id) if @tenant_id
244
- req['User-Agent']= 'loki-logstash'
245
- req.basic_auth(@client_id, @client_secret) if @client_id
246
- req.body = payload
242
+ client.add_field('Content-Type', 'application/json')
243
+ client.add_field('X-Scope-OrgID', @tenant_id) if @tenant_id
244
+ client['User-Agent']= 'loki-logstash'
245
+ client.basic_auth(@client_id, @client_secret) if @client_id
246
+ client.body = payload
247
247
 
248
248
  opts = ssl_opts(@uri)
249
249
 
250
- @logger.debug("sending #{req.body.length} bytes to loki")
250
+ @logger.debug("sending #{client.body.length} bytes to loki")
251
251
  retry_count = 0
252
252
  delay = @min_delay
253
253
  begin
254
254
  res = Net::HTTP.start(@uri.host, @uri.port, **opts) { |http|
255
- http.request(req)
255
+ http.request(client)
256
256
  }
257
257
  return res if !res.nil? && res.code.to_i != 429 && res.code.to_i.div(100) != 5
258
258
  raise StandardError.new res
@@ -278,6 +278,7 @@ class LogStash::Outputs::EDGE_Loki < LogStash::Outputs::Base
278
278
  @logger.info("createClient: started method")
279
279
  client = OAuth2::Client.new(@client_id, @client_secret, site: @url)
280
280
  client.auth_code.authorize_url(redirect_uri: @token_url)
281
+ @logger.info("createClient: started method", :client => client)
281
282
  return client
282
283
  end
283
284
 
@@ -1,6 +1,6 @@
1
1
  Gem::Specification.new do |s|
2
2
  s.name = 'logstash-output-edge_loki'
3
- s.version = '1.0.5'
3
+ s.version = '1.0.7'
4
4
  s.authors = ['Britto Prabhu']
5
5
  s.email = ['britto.prabhu@apmterminals.com']
6
6
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-output-edge_loki
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.0.5
4
+ version: 1.0.7
5
5
  platform: ruby
6
6
  authors:
7
7
  - Britto Prabhu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2023-09-03 00:00:00.000000000 Z
11
+ date: 2023-09-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement