fluent-plugin-sqlite3 0.1.2 → 1.0.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
  SHA1:
3
- metadata.gz: 0e67b08a54b3109c8962be8302ec65246e4c4711
4
- data.tar.gz: a81d985d9f9f52a33e2c0eedc848bbf3631666b3
3
+ metadata.gz: 3c87d717d7a4f68deae7983a924fd3d0d7f1ff70
4
+ data.tar.gz: b8a7d0a215ea5ba123a94606f3946e2c72136154
5
5
  SHA512:
6
- metadata.gz: 4b8c8a3280dd550022289bc6171389f036b486697d2e6c48a09c7a325113d5161237bb7f6adfd6b8e4ebcdcd40d966b2907efeb62a00a5785b02e8f311420b74
7
- data.tar.gz: c788a5d939247c1857a445807ff919ec77b28ff089ff43560c1c6232840f32b132f96635d7a6706eab978f4dfff199cf83cd8a795c6f2c00228cf7fdff987142
6
+ metadata.gz: eaef913843e40bc5613a5c77966427fb95a2a957f9c4da058d1b82722a6d2ead7120baf9cd5e789b9f561b3cae4f99014afe41ffc27b292c539df26cc2cefa29
7
+ data.tar.gz: 4ecea8193a1926ddee25a75e4fc60512836ff0ca1a977773a220b9d314ac699ccfa922702824dc027cc9070f90647e20f108ffed7a3ccbfbdf496a7c6b0d10be
@@ -1,14 +1,21 @@
1
1
  require "sqlite3"
2
+ require "fluent/plugin/output"
2
3
 
3
- class Fluent::Sqlite3Output < Fluent::BufferedOutput
4
+ class Fluent::Plugin::Sqlite3Output < Fluent::Plugin::Output
4
5
  Fluent::Plugin.register_output('sqlite3', self)
5
6
 
7
+ DEFAULT_BUFFER_TYPE = "memory"
8
+
6
9
  config_param :path, :string
7
10
  config_param :table, :string, :default => nil
8
11
  config_param :columns, :string, :default => nil
9
12
  config_param :includes, :string, :default => nil
10
13
  config_param :excludes, :string, :default => nil
11
14
 
15
+ config_section :buffer do
16
+ config_set_default :@type, DEFAULT_BUFFER_TYPE
17
+ end
18
+
12
19
  def initialize
13
20
  super
14
21
  end
@@ -22,7 +29,7 @@ class Fluent::Sqlite3Output < Fluent::BufferedOutput
22
29
  end
23
30
 
24
31
  DELIMITER = / *, */
25
-
32
+
26
33
  def start
27
34
  super
28
35
  @db = ::SQLite3::Database.new @path
@@ -39,10 +46,10 @@ class Fluent::Sqlite3Output < Fluent::BufferedOutput
39
46
  end
40
47
 
41
48
  def shutdown
42
- super
43
- $log.debug "shutdown"
49
+ log.debug "shutdown"
44
50
  @stmts.each {|k,v| v.close}
45
51
  @db.close
52
+ super
46
53
  end
47
54
 
48
55
  def format(tag, time, record)
@@ -56,15 +63,19 @@ class Fluent::Sqlite3Output < Fluent::BufferedOutput
56
63
  @db.commit
57
64
  rescue => ex
58
65
  @db.rollback
59
- $log.error "rollback: ", ex
66
+ log.error "rollback: ", ex
60
67
  raise
61
68
  end
62
69
  end
63
70
 
71
+ def formatted_to_msgpack_binary?
72
+ true
73
+ end
74
+
64
75
  def write1(chunk)
65
76
  chunk.msgpack_each do |tag, time, record|
66
77
  if record.keys.length == 0
67
- $log.warn "no any keys for #{tag}"
78
+ log.warn "no any keys for #{tag}"
68
79
  return
69
80
  end
70
81
  table = (@table or tag.split('.')[1]) # param 'table' or 2nd later part of tag.
@@ -78,7 +89,7 @@ class Fluent::Sqlite3Output < Fluent::BufferedOutput
78
89
  cols = record.keys.join ","
79
90
  @db.execute "CREATE TABLE IF NOT EXISTS #{table} (id INTEGER PRIMARY KEY AUTOINCREMENT,#{cols})"
80
91
  @stmts[table] = @db.prepare (a = to_insert(table, cols))
81
- $log.debug "create a new table, #{table.upcase} (it may have been already created)"
92
+ log.debug "create a new table, #{table.upcase} (it may have been already created)"
82
93
  end
83
94
  @stmts[table].execute record
84
95
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: fluent-plugin-sqlite3
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.2
4
+ version: 1.0.1
5
5
  platform: ruby
6
6
  authors:
7
7
  - Tomotaka Sakuma
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-09-22 00:00:00.000000000 Z
11
+ date: 2018-04-17 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: fluentd
@@ -16,28 +16,76 @@ dependencies:
16
16
  requirements:
17
17
  - - ">="
18
18
  - !ruby/object:Gem::Version
19
- version: '0'
19
+ version: 0.14.15
20
+ - - "<"
21
+ - !ruby/object:Gem::Version
22
+ version: '2'
20
23
  type: :runtime
21
24
  prerelease: false
22
25
  version_requirements: !ruby/object:Gem::Requirement
23
26
  requirements:
24
27
  - - ">="
25
28
  - !ruby/object:Gem::Version
26
- version: '0'
29
+ version: 0.14.15
30
+ - - "<"
31
+ - !ruby/object:Gem::Version
32
+ version: '2'
27
33
  - !ruby/object:Gem::Dependency
28
34
  name: sqlite3
29
35
  requirement: !ruby/object:Gem::Requirement
30
36
  requirements:
31
37
  - - ">="
32
38
  - !ruby/object:Gem::Version
33
- version: '0'
39
+ version: 1.3.7
34
40
  type: :runtime
35
41
  prerelease: false
36
42
  version_requirements: !ruby/object:Gem::Requirement
37
43
  requirements:
38
44
  - - ">="
39
45
  - !ruby/object:Gem::Version
40
- version: '0'
46
+ version: 1.3.7
47
+ - !ruby/object:Gem::Dependency
48
+ name: test-unit
49
+ requirement: !ruby/object:Gem::Requirement
50
+ requirements:
51
+ - - "~>"
52
+ - !ruby/object:Gem::Version
53
+ version: 3.2.0
54
+ type: :development
55
+ prerelease: false
56
+ version_requirements: !ruby/object:Gem::Requirement
57
+ requirements:
58
+ - - "~>"
59
+ - !ruby/object:Gem::Version
60
+ version: 3.2.0
61
+ - !ruby/object:Gem::Dependency
62
+ name: rake
63
+ requirement: !ruby/object:Gem::Requirement
64
+ requirements:
65
+ - - "~>"
66
+ - !ruby/object:Gem::Version
67
+ version: 12.0.0
68
+ type: :development
69
+ prerelease: false
70
+ version_requirements: !ruby/object:Gem::Requirement
71
+ requirements:
72
+ - - "~>"
73
+ - !ruby/object:Gem::Version
74
+ version: 12.0.0
75
+ - !ruby/object:Gem::Dependency
76
+ name: bundler
77
+ requirement: !ruby/object:Gem::Requirement
78
+ requirements:
79
+ - - "~>"
80
+ - !ruby/object:Gem::Version
81
+ version: '1.13'
82
+ type: :development
83
+ prerelease: false
84
+ version_requirements: !ruby/object:Gem::Requirement
85
+ requirements:
86
+ - - "~>"
87
+ - !ruby/object:Gem::Version
88
+ version: '1.13'
41
89
  description: fluentd output to sqlite3
42
90
  email: ktmtmks@gmail.com
43
91
  executables: []
@@ -64,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
64
112
  version: '0'
65
113
  requirements: []
66
114
  rubyforge_project:
67
- rubygems_version: 2.5.1
115
+ rubygems_version: 2.6.11
68
116
  signing_key:
69
117
  specification_version: 4
70
118
  summary: fluentd output to sqlite3