Class: Fluent::SolrTimeSlicedOutput
- Inherits:
-
TimeSlicedOutput
- Object
- TimeSlicedOutput
- Fluent::SolrTimeSlicedOutput
show all
- Includes:
- SolrConfigCommon, SolrUtil
- Defined in:
- lib/fluent/plugin/out_solr_time_sliced.rb
Overview
Solr output plugin for Fluent
Instance Attribute Summary
#localtime
Instance Method Summary
collapse
Methods included from SolrUtil
#update_core, #update_core_request
Constructor Details
18
19
20
21
22
23
24
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 18
def initialize
require 'net/http'
require 'uri'
require 'time'
super
@localtime = true
end
|
Instance Method Details
26
27
28
29
30
31
32
33
34
35
36
37
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 26
def configure(conf)
if conf['core']
if conf['core'].index('%S')
conf['time_slice_format'] = '%Y%m%d%H%M%S'
elsif conf['core'].index('%M')
conf['time_slice_format'] = '%Y%m%d%H%M'
elsif conf['core'].index('%H')
conf['time_slice_format'] = '%Y%m%d%H'
end
end
super
end
|
51
52
53
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 51
def core_format(chunk_key)
Time.strptime(chunk_key, @time_slice_format).strftime(@core)
end
|
43
44
45
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 43
def format(tag, time, record)
[tag, time, record].to_msgpack
end
|
#shutdown ⇒ Object
47
48
49
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 47
def shutdown
super
end
|
#start ⇒ Object
39
40
41
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 39
def start
super
end
|
#write(chunk) ⇒ Object
55
56
57
|
# File 'lib/fluent/plugin/out_solr_time_sliced.rb', line 55
def write(chunk)
update_core(chunk, core_format(chunk.key))
end
|