fluent-plugin-site24x7 0.1.1 → 0.1.2

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: 0f64dbce42d3ac7dc65c2e58daf74be07be8657c7cb9ec81089a0212cb15509b
4
- data.tar.gz: b4732542ec17f5bb32d34dc218ae5c4e1b12064978d46ba3d0dec591d5be8115
3
+ metadata.gz: c2391265977dd8a33dde6dab1876296406fae59c7633aa0ec0045821bb5688f1
4
+ data.tar.gz: 6bd7a51fca919c3c38c4f12cf226f403772c473d12f8c2a716f72ccb844f5ec7
5
5
  SHA512:
6
- metadata.gz: b5a1be07bed5a2f8aa0d4f5ea6572fd7ed4dc1cb635cca6b5f7329418d46aebc1bc6278a5f9823705f05e373a03fcffaec7bdc63a9040f2ba832e14bf33ef342
7
- data.tar.gz: 8ef90d45f72943d151cbeed6121043c3c3c47a956f50a4c6a702bc91d79d30e627a61007985036c09cd7f5d6322c88a46557303cca7334ff147cf2734e956def
6
+ metadata.gz: aab17017da06b62df8c7ebc8b2ee5e045e9833687945fd1f262890bd32bc9478f58208e1e07675e4295dd5c05fc6691bad50a19c35ea635c50d627438bb6dd01
7
+ data.tar.gz: de638056920dcc7cce4a00c1bddad3a4628ce5342e3b837e430d599f5f0db949ffcd81ff18efa55eca2e2d07b8dec761f3bd673367a076af3c69e8dcee6dd7ef
@@ -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-site24x7"
6
- spec.version = "0.1.1"
6
+ spec.version = "0.1.2"
7
7
  spec.authors = ["Magesh Rajan"]
8
8
  spec.email = ["magesh.rajan@zohocorp.com"]
9
9
 
@@ -64,8 +64,13 @@ class Fluent::Site24x7Output < Fluent::Plugin::Output
64
64
  @s247_http_client.shutdown if @s247_http_client
65
65
  end
66
66
 
67
+ def base64_url_decode(str)
68
+ str += '=' * (4 - str.length.modulo(4))
69
+ Base64.decode64(str.tr('-_','+/'))
70
+ end
71
+
67
72
  def init_variables()
68
- @logtype_config = Yajl::Parser.parse(Base64.decode64(@log_type_config))
73
+ @logtype_config = Yajl::Parser.parse(base64_url_decode(@log_type_config))
69
74
  @s247_custom_regex = if @logtype_config.has_key? 'regex' then Regexp.compile(@logtype_config['regex'].gsub('?P<','?<')) else nil end
70
75
  @s247_ignored_fields = if @logtype_config.has_key? 'ignored_fields' then @logtype_config['ignored_fields'] else [] end
71
76
  @s247_tz = {'hrs': 0, 'mins': 0} #UTC
@@ -76,12 +81,12 @@ class Fluent::Site24x7Output < Fluent::Plugin::Output
76
81
  @s247_datetime_format_string = @logtype_config['dateFormat']
77
82
  @s247_datetime_format_string = @s247_datetime_format_string.sub('%f', '%N')
78
83
  if !@s247_datetime_format_string.include? 'unix'
79
- is_year_present = if @s247_datetime_format_string.include?('%y') || @s247_datetime_format_string.include?('%Y') then true else false end
80
- if !is_year_present
84
+ @is_year_present = if @s247_datetime_format_string.include?('%y') || @s247_datetime_format_string.include?('%Y') then true else false end
85
+ if !@is_year_present
81
86
  @s247_datetime_format_string = @s247_datetime_format_string+ ' %Y'
82
87
  end
83
- is_timezone_present = if @s247_datetime_format_string.include? '%z' then true else false end
84
- if !is_timezone_present && @logtype_config.has_key?('timezone')
88
+ @is_timezone_present = if @s247_datetime_format_string.include? '%z' then true else false end
89
+ if !@is_timezone_present && @logtype_config.has_key?('timezone')
85
90
  tz_value = @logtype_config['timezone']
86
91
  if tz_value.start_with?('+')
87
92
  @s247_tz['hrs'] = Integer('-' + tz_value[1..4])
@@ -120,8 +125,8 @@ class Fluent::Site24x7Output < Fluent::Plugin::Output
120
125
  if @s247_datetime_format_string.include? 'unix'
121
126
  return (if @s247_datetime_format_string == 'unix' then datetime_string+'000' else datetime_string end)
122
127
  end
123
- datetime_string += if !is_year_present then ' '+String(Time.new.year) else '' end
124
- if !is_timezone_present
128
+ datetime_string += if !@is_year_present then ' '+String(Time.new.year) else '' end
129
+ if !@is_timezone_present && @logtype_config.has_key?('timezone')
125
130
  @s247_datetime_format_string += '%z'
126
131
  time_zone = String(@s247_tz['hrs'])+':'+String(@s247_tz['mins'])
127
132
  datetime_string += if time_zone.start_with?('-') then time_zone else '+'+time_zone end
@@ -150,6 +155,8 @@ class Fluent::Site24x7Output < Fluent::Plugin::Output
150
155
  formatted_line.merge!(log_fields)
151
156
  parsed_lines.push(formatted_line)
152
157
  log_size -= removed_log_size
158
+ else
159
+ log.debug "pattern not matched regex : #{@s247_custom_regex} and received line : #{line}"
153
160
  end
154
161
  rescue Exception => e
155
162
  log.error "Exception in parse_line #{e.backtrace}"
@@ -345,7 +352,7 @@ class Fluent::Site24x7Output < Fluent::Plugin::Output
345
352
  end
346
353
  end
347
354
  rescue Exception => e
348
- log.error "Exception occurred in sendig logs : #{e}"
355
+ log.error "Exception occurred in sendig logs : #{e.backtrace}"
349
356
  end
350
357
  end
351
358
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-site24x7
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.1
4
+ version: 0.1.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Magesh Rajan
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-08-02 00:00:00.000000000 Z
11
+ date: 2021-08-12 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler