fluent-plugin-postgresql-csvlog 0.2.0 → 0.2.1

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: 5dda962fe3d98ea5f101183e982959b78c92142ca2b9a7807e51567a2bc75819
4
- data.tar.gz: 3efd68ecdc6bcdb0a3341b2a5961452508ea92b10a2e5eeba6843cb29f27009a
3
+ metadata.gz: 1c99895582e6133a97c194d676882f42d0fad0ab52aff6cfe1b3fbbbcf32263a
4
+ data.tar.gz: 71135c5dddefbf8a61f8f6e3453daddd61df187b082201fb00dff4680ce0bdbe
5
5
  SHA512:
6
- metadata.gz: 47099891a7c455ce85e98239b3c69990b7c14b5450f2be9d643902c00ac29a6bbb7a5f34678380b1e310414308e80514f8915b0865f92ef7524221d35fc75ca8
7
- data.tar.gz: 22bd0a3a4f2bf5ef903c3f90d11d0f92a5822887a07cd048eca701a4cb270c8be4f1c43f5fa2e9f3529ec26896874f9156dc0eac457c07028f41e03e3e7bf34a
6
+ metadata.gz: 518a30b929f02f82a6a6d80d03a4a1a9fa66174759c8f9b89a3243a7bf4d8168a43fe08631882630790afea4fb24eed4179215f85d7454c8fc63fc6e2aae1c6e
7
+ data.tar.gz: 43921a20185c91042274d0acbbd4c70ef94cb7c199675833890ab2cc946aa49065b8c0a624eb6691684e55bfa0945a02e9996f305211657ffae492e856deebe2
@@ -2,7 +2,7 @@ $:.push File.expand_path('lib', __dir__)
2
2
 
3
3
  Gem::Specification.new do |s|
4
4
  s.name = 'fluent-plugin-postgresql-csvlog'
5
- s.version = '0.2.0'
5
+ s.version = '0.2.1'
6
6
  s.authors = ['stanhu']
7
7
  s.email = ['stanhu@gmail.com']
8
8
  s.homepage = 'https://gitlab.com/gitlab-org/fluent-plugin-postgresql-csvlog'
@@ -26,7 +26,6 @@ module Fluent::Plugin
26
26
 
27
27
  record.delete(@input_key)
28
28
  record[@output_key] = normalized
29
- record.delete('message')
30
29
 
31
30
  record
32
31
  rescue PgQuery::ParseError
@@ -24,6 +24,7 @@ module Fluent
24
24
  if record['message'] =~ SLOWLOG_REGEXP
25
25
  record['duration_s'] = $1.to_f / 1000.0
26
26
  record[@output_key] = $2
27
+ record.delete('message')
27
28
  end
28
29
  # rubocop:enable Style/PerlBackrefs
29
30
 
@@ -27,7 +27,7 @@ class PostgreSQLRedactorTest < Test::Unit::TestCase
27
27
  inputs.each { |input| d.feed(input) }
28
28
  end
29
29
 
30
- assert_equal(%w[duration_s fingerprint sql], d.filtered[0].last.keys.sort)
30
+ assert_equal(%w[duration_s fingerprint message sql], d.filtered[0].last.keys.sort)
31
31
  assert_equal('SELECT * FROM projects WHERE id = $1', d.filtered[0].last['sql'])
32
32
  end
33
33
 
@@ -63,7 +63,7 @@ class PostgreSQLRedactorTest < Test::Unit::TestCase
63
63
  inputs.each { |input| d.feed(input) }
64
64
  end
65
65
 
66
- assert_equal(%w[duration_s fingerprint out_sql], d.filtered[0].last.keys.sort)
66
+ assert_equal(%w[duration_s fingerprint message out_sql], d.filtered[0].last.keys.sort)
67
67
  assert_equal('SELECT * FROM projects WHERE id = $1', d.filtered[0].last['out_sql'])
68
68
  end
69
69
  end
@@ -44,6 +44,9 @@ class PostgreSQLSlowLogTest < Test::Unit::TestCase
44
44
  }
45
45
  ),
46
46
  d.filtered[1].last)
47
+
48
+ assert_equal(%w[duration_s query], d.filtered[0].last.keys.sort)
49
+ assert_equal(%w[duration_s query], d.filtered[1].last.keys.sort)
47
50
  end
48
51
 
49
52
  test 'ignores messages not having to do with slow logs' do
@@ -55,6 +58,7 @@ class PostgreSQLSlowLogTest < Test::Unit::TestCase
55
58
  end
56
59
 
57
60
  assert_equal(input, d.filtered[0].last)
61
+ assert_equal(%w[message], d.filtered[0].last.keys.sort)
58
62
  end
59
63
 
60
64
  test 'outputs slow log entries to configured output key' do
@@ -79,5 +83,7 @@ class PostgreSQLSlowLogTest < Test::Unit::TestCase
79
83
  }
80
84
  ),
81
85
  d.filtered[0].last)
86
+
87
+ assert_equal(%w[duration_s my_key], d.filtered[0].last.keys.sort)
82
88
  end
83
89
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-postgresql-csvlog
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.0
4
+ version: 0.2.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - stanhu
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2021-03-22 00:00:00.000000000 Z
11
+ date: 2021-03-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd