Class: Fluent::HttpFileUploadOutput
- Inherits:
-
BufferedOutput
- Object
- BufferedOutput
- Fluent::HttpFileUploadOutput
- Includes:
- SetTimeKeyMixin
- Defined in:
- lib/fluent/plugin/out_http_file_upload.rb
Instance Method Summary collapse
-
#configure(conf) ⇒ Object
TODO: support compression TODO: support gzipped transferring.
- #format(tag, time, record) ⇒ Object
- #write(chunk) ⇒ Object
Instance Method Details
#configure(conf) ⇒ Object
TODO: support compression TODO: support gzipped transferring
36 37 38 39 40 41 42 43 |
# File 'lib/fluent/plugin/out_http_file_upload.rb', line 36 def configure(conf) super @formatter = Plugin.new_formatter(@format) @formatter.configure(conf) @client = HTTPClient.new(agent_name: @user_agent) # @client.debug_dev = $stderr end |
#format(tag, time, record) ⇒ Object
45 46 47 |
# File 'lib/fluent/plugin/out_http_file_upload.rb', line 45 def format(tag, time, record) @formatter.format(tag, time, record) end |
#write(chunk) ⇒ Object
49 50 51 52 53 54 55 56 57 58 59 |
# File 'lib/fluent/plugin/out_http_file_upload.rb', line 49 def write(chunk) filename = Time.now.strftime(@filename) chunk.open do |io| io.singleton_class.class_eval{ define_method(:path){ filename } } postdata = { @param_name => io } unless @parameters.empty? postdata = @parameters.merge(postdata) end @client.post(@uri, postdata, @headers) end end |