fluent-plugin-journal-parser 0.1.0 → 0.1.1

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: ba092ee44c8e2e040c85699cb4f81a21c1d443b6
4
- data.tar.gz: 980551f8ae8333b7d177df9c42a2131a48e40dab
3
+ metadata.gz: a16bb348493fe2845da557cea2808ee3c4bdd376
4
+ data.tar.gz: 8ae50e9e45d35992644940e45e8e25468e03aa62
5
5
  SHA512:
6
- metadata.gz: 6180aaf1c780caa6c2e739ef4469906c17ea936a963eb84e66a27b6f4e2d0b6d838bc3342f1e71a683eb15e8f84be7be6fb411880fd8c42a1d5b338b9dc0e2ad
7
- data.tar.gz: fb9ed299cf0d6ed9bc39caef5d3d5d7fff9b2c6a3e67a52bba3bf7c2606e32cfe369c3a5aefba9af19dbfab9d8db98847cfa1474d8d9b18abc4ea31715d621ac
6
+ metadata.gz: 384f0354ed5b6756225ae1c7e917dd8989b7813597b91c325a44be1dce98dc32be836e7a2d8b662cd80e85cc7dfc669371df2d89c021ccf1c1b51dc00c430b36
7
+ data.tar.gz: 1f6d8082fce1e6cdb66a3b7b4f6e59a447853881d318d4f136b73082c830feb7e04cf92517db2668f239fdf6bda17f11636536cc1fa33687623ec4299483f7f6
@@ -29,15 +29,18 @@ begin # fluentd >= 0.14
29
29
  record = {}
30
30
  while (m = text.index(/[=\n]/, n)) != n
31
31
  raise ParserError if m.nil?
32
- key = text.slice(n, m-n)
32
+ key = text.slice(n, m-n).force_encoding(Encoding::UTF_8)
33
+ raise ParserError unless key.valid_encoding?
33
34
  n = m+1 # continue parsing after newline/equal sign
34
35
  if text[m] == '=' # simple field
35
36
  m = text.index("\n", n)
36
- value = text.slice(n, m-n)
37
+ value = text.slice(n, m-n).force_encoding(Encoding::UTF_8)
38
+ raise ParserError unless value.valid_encoding?
37
39
  else # text[m] == "\n" # binary safe field
38
40
  m = text.slice(n, 8).unpack('Q<')[0]
39
41
  n += 8
40
- value = text.slice(n, m)
42
+ value = text.slice(n, m).force_encoding(Encoding::UTF_8)
43
+ value.force_encoding(Encoding::ASCII_8BIT) unless value.valid_encoding?
41
44
  m = n+m
42
45
  end
43
46
  record[key] = value
@@ -73,15 +76,18 @@ rescue LoadError # fluentd < 0.14
73
76
  record = {}
74
77
  while (m = text.index(/[=\n]/, n)) != n
75
78
  raise ParserError if m.nil?
76
- key = text.slice(n, m-n)
79
+ key = text.slice(n, m-n).force_encoding(Encoding::UTF_8)
80
+ raise ParserError unless key.valid_encoding?
77
81
  n = m+1 # continue parsing after newline/equal sign
78
82
  if text[m] == '=' # simple field
79
83
  m = text.index("\n", n)
80
- value = text.slice(n, m-n)
84
+ value = text.slice(n, m-n).force_encoding(Encoding::UTF_8)
85
+ raise ParserError unless value.valid_encoding?
81
86
  else # text[m] == "\n" # binary safe field
82
87
  m = text.slice(n, 8).unpack('Q<')[0]
83
88
  n += 8
84
- value = text.slice(n, m)
89
+ value = text.slice(n, m).force_encoding(Encoding::UTF_8)
90
+ value.force_encoding(Encoding::ASCII_8BIT) unless value.valid_encoding?
85
91
  m = n+m
86
92
  end
87
93
  record[key] = value
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-journal-parser
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.1.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Emil Renner Berthing
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-27 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -52,7 +52,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
52
52
  version: '0'
53
53
  requirements: []
54
54
  rubyforge_project:
55
- rubygems_version: 2.5.1
55
+ rubygems_version: 2.6.8
56
56
  signing_key:
57
57
  specification_version: 4
58
58
  summary: Fluentd plugin to parse systemd journal export format.