Class: Fluent::SolrTimeSlicedOutput
- Inherits:
-
TimeSlicedOutput
- Object
- TimeSlicedOutput
- Fluent::SolrTimeSlicedOutput
- Includes:
- SolrConfigCommon, SolrUtil
- Defined in:
- lib/fluent/plugin/out_solr_time_sliced.rb
Overview
Solr output plugin for Fluent
Instance Attribute Summary
Attributes included from SolrConfigCommon
Instance Method Summary collapse
- #configure(conf) ⇒ Object
- #core_format(chunk_key) ⇒ Object
- #format(tag, time, record) ⇒ Object
-
#initialize ⇒ SolrTimeSlicedOutput
constructor
A new instance of SolrTimeSlicedOutput.
- #shutdown ⇒ Object
- #start ⇒ Object
- #write(chunk) ⇒ Object
Methods included from SolrUtil
Constructor Details
#initialize ⇒ SolrTimeSlicedOutput
Returns a new instance of SolrTimeSlicedOutput.
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
#configure(conf) ⇒ Object
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 |
#core_format(chunk_key) ⇒ Object
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 |
#format(tag, time, record) ⇒ Object
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 |