fluentd-hubspot 0.14.14.1
Sign up to get free protection for your applications and to get access to all the features.
- data/.github/ISSUE_TEMPLATE.md +6 -0
- data/.gitignore +28 -0
- data/.travis.yml +51 -0
- data/AUTHORS +2 -0
- data/CONTRIBUTING.md +42 -0
- data/COPYING +14 -0
- data/ChangeLog +593 -0
- data/Gemfile +9 -0
- data/README.md +76 -0
- data/Rakefile +74 -0
- data/Vagrantfile +17 -0
- data/appveyor.yml +43 -0
- data/bin/fluent-binlog-reader +7 -0
- data/bin/fluent-debug +5 -0
- data/bin/fluent-plugin-config-format +5 -0
- data/bin/fluent-plugin-generate +5 -0
- data/code-of-conduct.md +3 -0
- data/example/copy_roundrobin.conf +39 -0
- data/example/filter_stdout.conf +22 -0
- data/example/in_dummy_blocks.conf +17 -0
- data/example/in_dummy_with_compression.conf +23 -0
- data/example/in_forward.conf +14 -0
- data/example/in_forward_client.conf +37 -0
- data/example/in_forward_shared_key.conf +15 -0
- data/example/in_forward_tls.conf +14 -0
- data/example/in_forward_users.conf +24 -0
- data/example/in_forward_workers.conf +21 -0
- data/example/in_http.conf +14 -0
- data/example/in_out_forward.conf +17 -0
- data/example/in_syslog.conf +15 -0
- data/example/in_tail.conf +14 -0
- data/example/in_tcp.conf +13 -0
- data/example/in_udp.conf +13 -0
- data/example/logevents.conf +25 -0
- data/example/multi_filters.conf +61 -0
- data/example/out_copy.conf +20 -0
- data/example/out_exec_filter.conf +42 -0
- data/example/out_file.conf +13 -0
- data/example/out_forward.conf +35 -0
- data/example/out_forward_buf_file.conf +23 -0
- data/example/out_forward_client.conf +109 -0
- data/example/out_forward_heartbeat_none.conf +16 -0
- data/example/out_forward_shared_key.conf +36 -0
- data/example/out_forward_tls.conf +18 -0
- data/example/out_forward_users.conf +65 -0
- data/example/out_null.conf +36 -0
- data/example/secondary_file.conf +41 -0
- data/example/suppress_config_dump.conf +7 -0
- data/example/v0_12_filter.conf +78 -0
- data/example/v1_literal_example.conf +36 -0
- data/fluent.conf +139 -0
- data/fluentd.gemspec +51 -0
- data/lib/fluent/agent.rb +163 -0
- data/lib/fluent/clock.rb +62 -0
- data/lib/fluent/command/binlog_reader.rb +234 -0
- data/lib/fluent/command/bundler_injection.rb +45 -0
- data/lib/fluent/command/cat.rb +330 -0
- data/lib/fluent/command/debug.rb +102 -0
- data/lib/fluent/command/fluentd.rb +301 -0
- data/lib/fluent/command/plugin_config_formatter.rb +258 -0
- data/lib/fluent/command/plugin_generator.rb +301 -0
- data/lib/fluent/compat/call_super_mixin.rb +67 -0
- data/lib/fluent/compat/detach_process_mixin.rb +25 -0
- data/lib/fluent/compat/exec_util.rb +129 -0
- data/lib/fluent/compat/file_util.rb +54 -0
- data/lib/fluent/compat/filter.rb +68 -0
- data/lib/fluent/compat/formatter.rb +111 -0
- data/lib/fluent/compat/formatter_utils.rb +85 -0
- data/lib/fluent/compat/handle_tag_and_time_mixin.rb +62 -0
- data/lib/fluent/compat/handle_tag_name_mixin.rb +53 -0
- data/lib/fluent/compat/input.rb +59 -0
- data/lib/fluent/compat/output.rb +728 -0
- data/lib/fluent/compat/output_chain.rb +60 -0
- data/lib/fluent/compat/parser.rb +310 -0
- data/lib/fluent/compat/parser_utils.rb +40 -0
- data/lib/fluent/compat/propagate_default.rb +62 -0
- data/lib/fluent/compat/record_filter_mixin.rb +34 -0
- data/lib/fluent/compat/set_tag_key_mixin.rb +50 -0
- data/lib/fluent/compat/set_time_key_mixin.rb +69 -0
- data/lib/fluent/compat/socket_util.rb +165 -0
- data/lib/fluent/compat/string_util.rb +34 -0
- data/lib/fluent/compat/structured_format_mixin.rb +26 -0
- data/lib/fluent/compat/type_converter.rb +90 -0
- data/lib/fluent/config.rb +56 -0
- data/lib/fluent/config/basic_parser.rb +123 -0
- data/lib/fluent/config/configure_proxy.rb +418 -0
- data/lib/fluent/config/dsl.rb +149 -0
- data/lib/fluent/config/element.rb +218 -0
- data/lib/fluent/config/error.rb +26 -0
- data/lib/fluent/config/literal_parser.rb +251 -0
- data/lib/fluent/config/parser.rb +107 -0
- data/lib/fluent/config/section.rb +223 -0
- data/lib/fluent/config/types.rb +136 -0
- data/lib/fluent/config/v1_parser.rb +190 -0
- data/lib/fluent/configurable.rb +200 -0
- data/lib/fluent/daemon.rb +15 -0
- data/lib/fluent/engine.rb +266 -0
- data/lib/fluent/env.rb +28 -0
- data/lib/fluent/error.rb +30 -0
- data/lib/fluent/event.rb +334 -0
- data/lib/fluent/event_router.rb +269 -0
- data/lib/fluent/filter.rb +21 -0
- data/lib/fluent/formatter.rb +23 -0
- data/lib/fluent/input.rb +21 -0
- data/lib/fluent/label.rb +46 -0
- data/lib/fluent/load.rb +35 -0
- data/lib/fluent/log.rb +546 -0
- data/lib/fluent/match.rb +178 -0
- data/lib/fluent/mixin.rb +31 -0
- data/lib/fluent/msgpack_factory.rb +62 -0
- data/lib/fluent/output.rb +29 -0
- data/lib/fluent/output_chain.rb +23 -0
- data/lib/fluent/parser.rb +23 -0
- data/lib/fluent/plugin.rb +183 -0
- data/lib/fluent/plugin/bare_output.rb +63 -0
- data/lib/fluent/plugin/base.rb +165 -0
- data/lib/fluent/plugin/buf_file.rb +184 -0
- data/lib/fluent/plugin/buf_memory.rb +34 -0
- data/lib/fluent/plugin/buffer.rb +617 -0
- data/lib/fluent/plugin/buffer/chunk.rb +221 -0
- data/lib/fluent/plugin/buffer/file_chunk.rb +364 -0
- data/lib/fluent/plugin/buffer/memory_chunk.rb +90 -0
- data/lib/fluent/plugin/compressable.rb +92 -0
- data/lib/fluent/plugin/exec_util.rb +22 -0
- data/lib/fluent/plugin/file_util.rb +22 -0
- data/lib/fluent/plugin/file_wrapper.rb +120 -0
- data/lib/fluent/plugin/filter.rb +93 -0
- data/lib/fluent/plugin/filter_grep.rb +75 -0
- data/lib/fluent/plugin/filter_parser.rb +119 -0
- data/lib/fluent/plugin/filter_record_transformer.rb +322 -0
- data/lib/fluent/plugin/filter_stdout.rb +53 -0
- data/lib/fluent/plugin/formatter.rb +50 -0
- data/lib/fluent/plugin/formatter_csv.rb +52 -0
- data/lib/fluent/plugin/formatter_hash.rb +33 -0
- data/lib/fluent/plugin/formatter_json.rb +55 -0
- data/lib/fluent/plugin/formatter_ltsv.rb +42 -0
- data/lib/fluent/plugin/formatter_msgpack.rb +33 -0
- data/lib/fluent/plugin/formatter_out_file.rb +51 -0
- data/lib/fluent/plugin/formatter_single_value.rb +34 -0
- data/lib/fluent/plugin/formatter_stdout.rb +75 -0
- data/lib/fluent/plugin/formatter_tsv.rb +34 -0
- data/lib/fluent/plugin/in_debug_agent.rb +64 -0
- data/lib/fluent/plugin/in_dummy.rb +139 -0
- data/lib/fluent/plugin/in_exec.rb +108 -0
- data/lib/fluent/plugin/in_forward.rb +455 -0
- data/lib/fluent/plugin/in_gc_stat.rb +56 -0
- data/lib/fluent/plugin/in_http.rb +433 -0
- data/lib/fluent/plugin/in_monitor_agent.rb +448 -0
- data/lib/fluent/plugin/in_object_space.rb +93 -0
- data/lib/fluent/plugin/in_syslog.rb +209 -0
- data/lib/fluent/plugin/in_tail.rb +905 -0
- data/lib/fluent/plugin/in_tcp.rb +85 -0
- data/lib/fluent/plugin/in_udp.rb +81 -0
- data/lib/fluent/plugin/in_unix.rb +201 -0
- data/lib/fluent/plugin/input.rb +37 -0
- data/lib/fluent/plugin/multi_output.rb +157 -0
- data/lib/fluent/plugin/out_copy.rb +46 -0
- data/lib/fluent/plugin/out_exec.rb +105 -0
- data/lib/fluent/plugin/out_exec_filter.rb +317 -0
- data/lib/fluent/plugin/out_file.rb +302 -0
- data/lib/fluent/plugin/out_forward.rb +912 -0
- data/lib/fluent/plugin/out_null.rb +74 -0
- data/lib/fluent/plugin/out_relabel.rb +32 -0
- data/lib/fluent/plugin/out_roundrobin.rb +84 -0
- data/lib/fluent/plugin/out_secondary_file.rb +133 -0
- data/lib/fluent/plugin/out_stdout.rb +75 -0
- data/lib/fluent/plugin/out_stream.rb +130 -0
- data/lib/fluent/plugin/output.rb +1291 -0
- data/lib/fluent/plugin/owned_by_mixin.rb +42 -0
- data/lib/fluent/plugin/parser.rb +191 -0
- data/lib/fluent/plugin/parser_apache.rb +28 -0
- data/lib/fluent/plugin/parser_apache2.rb +84 -0
- data/lib/fluent/plugin/parser_apache_error.rb +26 -0
- data/lib/fluent/plugin/parser_csv.rb +39 -0
- data/lib/fluent/plugin/parser_json.rb +81 -0
- data/lib/fluent/plugin/parser_ltsv.rb +42 -0
- data/lib/fluent/plugin/parser_msgpack.rb +50 -0
- data/lib/fluent/plugin/parser_multiline.rb +105 -0
- data/lib/fluent/plugin/parser_nginx.rb +28 -0
- data/lib/fluent/plugin/parser_none.rb +36 -0
- data/lib/fluent/plugin/parser_regexp.rb +63 -0
- data/lib/fluent/plugin/parser_syslog.rb +121 -0
- data/lib/fluent/plugin/parser_tsv.rb +42 -0
- data/lib/fluent/plugin/socket_util.rb +22 -0
- data/lib/fluent/plugin/storage.rb +84 -0
- data/lib/fluent/plugin/storage_local.rb +159 -0
- data/lib/fluent/plugin/string_util.rb +22 -0
- data/lib/fluent/plugin_helper.rb +70 -0
- data/lib/fluent/plugin_helper/cert_option.rb +159 -0
- data/lib/fluent/plugin_helper/child_process.rb +364 -0
- data/lib/fluent/plugin_helper/compat_parameters.rb +331 -0
- data/lib/fluent/plugin_helper/event_emitter.rb +93 -0
- data/lib/fluent/plugin_helper/event_loop.rb +161 -0
- data/lib/fluent/plugin_helper/extract.rb +104 -0
- data/lib/fluent/plugin_helper/formatter.rb +147 -0
- data/lib/fluent/plugin_helper/inject.rb +151 -0
- data/lib/fluent/plugin_helper/parser.rb +147 -0
- data/lib/fluent/plugin_helper/retry_state.rb +201 -0
- data/lib/fluent/plugin_helper/server.rb +738 -0
- data/lib/fluent/plugin_helper/socket.rb +241 -0
- data/lib/fluent/plugin_helper/socket_option.rb +69 -0
- data/lib/fluent/plugin_helper/storage.rb +349 -0
- data/lib/fluent/plugin_helper/thread.rb +179 -0
- data/lib/fluent/plugin_helper/timer.rb +91 -0
- data/lib/fluent/plugin_id.rb +80 -0
- data/lib/fluent/process.rb +22 -0
- data/lib/fluent/registry.rb +116 -0
- data/lib/fluent/root_agent.rb +323 -0
- data/lib/fluent/rpc.rb +94 -0
- data/lib/fluent/supervisor.rb +741 -0
- data/lib/fluent/system_config.rb +159 -0
- data/lib/fluent/test.rb +58 -0
- data/lib/fluent/test/base.rb +78 -0
- data/lib/fluent/test/driver/base.rb +224 -0
- data/lib/fluent/test/driver/base_owned.rb +70 -0
- data/lib/fluent/test/driver/base_owner.rb +135 -0
- data/lib/fluent/test/driver/event_feeder.rb +98 -0
- data/lib/fluent/test/driver/filter.rb +57 -0
- data/lib/fluent/test/driver/formatter.rb +30 -0
- data/lib/fluent/test/driver/input.rb +31 -0
- data/lib/fluent/test/driver/multi_output.rb +53 -0
- data/lib/fluent/test/driver/output.rb +102 -0
- data/lib/fluent/test/driver/parser.rb +30 -0
- data/lib/fluent/test/driver/test_event_router.rb +45 -0
- data/lib/fluent/test/filter_test.rb +77 -0
- data/lib/fluent/test/formatter_test.rb +65 -0
- data/lib/fluent/test/helpers.rb +134 -0
- data/lib/fluent/test/input_test.rb +174 -0
- data/lib/fluent/test/log.rb +79 -0
- data/lib/fluent/test/output_test.rb +156 -0
- data/lib/fluent/test/parser_test.rb +70 -0
- data/lib/fluent/test/startup_shutdown.rb +46 -0
- data/lib/fluent/time.rb +412 -0
- data/lib/fluent/timezone.rb +133 -0
- data/lib/fluent/unique_id.rb +39 -0
- data/lib/fluent/version.rb +21 -0
- data/lib/fluent/winsvc.rb +71 -0
- data/templates/new_gem/Gemfile +3 -0
- data/templates/new_gem/README.md.erb +43 -0
- data/templates/new_gem/Rakefile +13 -0
- data/templates/new_gem/fluent-plugin.gemspec.erb +27 -0
- data/templates/new_gem/lib/fluent/plugin/filter.rb.erb +14 -0
- data/templates/new_gem/lib/fluent/plugin/formatter.rb.erb +14 -0
- data/templates/new_gem/lib/fluent/plugin/input.rb.erb +11 -0
- data/templates/new_gem/lib/fluent/plugin/output.rb.erb +11 -0
- data/templates/new_gem/lib/fluent/plugin/parser.rb.erb +15 -0
- data/templates/new_gem/test/helper.rb.erb +8 -0
- data/templates/new_gem/test/plugin/test_filter.rb.erb +18 -0
- data/templates/new_gem/test/plugin/test_formatter.rb.erb +18 -0
- data/templates/new_gem/test/plugin/test_input.rb.erb +18 -0
- data/templates/new_gem/test/plugin/test_output.rb.erb +18 -0
- data/templates/new_gem/test/plugin/test_parser.rb.erb +18 -0
- data/templates/plugin_config_formatter/param.md-compact.erb +25 -0
- data/templates/plugin_config_formatter/param.md.erb +34 -0
- data/templates/plugin_config_formatter/section.md.erb +12 -0
- data/test/command/test_binlog_reader.rb +346 -0
- data/test/command/test_fluentd.rb +618 -0
- data/test/command/test_plugin_config_formatter.rb +275 -0
- data/test/command/test_plugin_generator.rb +66 -0
- data/test/compat/test_calls_super.rb +166 -0
- data/test/compat/test_parser.rb +92 -0
- data/test/config/assertions.rb +42 -0
- data/test/config/test_config_parser.rb +513 -0
- data/test/config/test_configurable.rb +1587 -0
- data/test/config/test_configure_proxy.rb +566 -0
- data/test/config/test_dsl.rb +415 -0
- data/test/config/test_element.rb +403 -0
- data/test/config/test_literal_parser.rb +297 -0
- data/test/config/test_section.rb +184 -0
- data/test/config/test_system_config.rb +168 -0
- data/test/config/test_types.rb +191 -0
- data/test/helper.rb +153 -0
- data/test/plugin/data/2010/01/20100102-030405.log +0 -0
- data/test/plugin/data/2010/01/20100102-030406.log +0 -0
- data/test/plugin/data/2010/01/20100102.log +0 -0
- data/test/plugin/data/log/bar +0 -0
- data/test/plugin/data/log/foo/bar.log +0 -0
- data/test/plugin/data/log/foo/bar2 +0 -0
- data/test/plugin/data/log/test.log +0 -0
- data/test/plugin/test_bare_output.rb +118 -0
- data/test/plugin/test_base.rb +115 -0
- data/test/plugin/test_buf_file.rb +843 -0
- data/test/plugin/test_buf_memory.rb +42 -0
- data/test/plugin/test_buffer.rb +1220 -0
- data/test/plugin/test_buffer_chunk.rb +198 -0
- data/test/plugin/test_buffer_file_chunk.rb +844 -0
- data/test/plugin/test_buffer_memory_chunk.rb +338 -0
- data/test/plugin/test_compressable.rb +84 -0
- data/test/plugin/test_file_util.rb +96 -0
- data/test/plugin/test_filter.rb +357 -0
- data/test/plugin/test_filter_grep.rb +119 -0
- data/test/plugin/test_filter_parser.rb +700 -0
- data/test/plugin/test_filter_record_transformer.rb +556 -0
- data/test/plugin/test_filter_stdout.rb +202 -0
- data/test/plugin/test_formatter_csv.rb +111 -0
- data/test/plugin/test_formatter_hash.rb +35 -0
- data/test/plugin/test_formatter_json.rb +51 -0
- data/test/plugin/test_formatter_ltsv.rb +59 -0
- data/test/plugin/test_formatter_msgpack.rb +28 -0
- data/test/plugin/test_formatter_out_file.rb +95 -0
- data/test/plugin/test_formatter_single_value.rb +38 -0
- data/test/plugin/test_in_debug_agent.rb +28 -0
- data/test/plugin/test_in_dummy.rb +192 -0
- data/test/plugin/test_in_exec.rb +245 -0
- data/test/plugin/test_in_forward.rb +1120 -0
- data/test/plugin/test_in_gc_stat.rb +39 -0
- data/test/plugin/test_in_http.rb +588 -0
- data/test/plugin/test_in_monitor_agent.rb +516 -0
- data/test/plugin/test_in_object_space.rb +64 -0
- data/test/plugin/test_in_syslog.rb +271 -0
- data/test/plugin/test_in_tail.rb +1216 -0
- data/test/plugin/test_in_tcp.rb +118 -0
- data/test/plugin/test_in_udp.rb +152 -0
- data/test/plugin/test_in_unix.rb +126 -0
- data/test/plugin/test_input.rb +126 -0
- data/test/plugin/test_multi_output.rb +180 -0
- data/test/plugin/test_out_copy.rb +160 -0
- data/test/plugin/test_out_exec.rb +310 -0
- data/test/plugin/test_out_exec_filter.rb +613 -0
- data/test/plugin/test_out_file.rb +873 -0
- data/test/plugin/test_out_forward.rb +685 -0
- data/test/plugin/test_out_null.rb +105 -0
- data/test/plugin/test_out_relabel.rb +28 -0
- data/test/plugin/test_out_roundrobin.rb +146 -0
- data/test/plugin/test_out_secondary_file.rb +442 -0
- data/test/plugin/test_out_stdout.rb +170 -0
- data/test/plugin/test_out_stream.rb +93 -0
- data/test/plugin/test_output.rb +870 -0
- data/test/plugin/test_output_as_buffered.rb +1932 -0
- data/test/plugin/test_output_as_buffered_compress.rb +165 -0
- data/test/plugin/test_output_as_buffered_overflow.rb +250 -0
- data/test/plugin/test_output_as_buffered_retries.rb +839 -0
- data/test/plugin/test_output_as_buffered_secondary.rb +877 -0
- data/test/plugin/test_output_as_standard.rb +374 -0
- data/test/plugin/test_owned_by.rb +35 -0
- data/test/plugin/test_parser.rb +359 -0
- data/test/plugin/test_parser_apache.rb +42 -0
- data/test/plugin/test_parser_apache2.rb +46 -0
- data/test/plugin/test_parser_apache_error.rb +45 -0
- data/test/plugin/test_parser_csv.rb +103 -0
- data/test/plugin/test_parser_json.rb +114 -0
- data/test/plugin/test_parser_labeled_tsv.rb +128 -0
- data/test/plugin/test_parser_multiline.rb +100 -0
- data/test/plugin/test_parser_nginx.rb +48 -0
- data/test/plugin/test_parser_none.rb +52 -0
- data/test/plugin/test_parser_regexp.rb +281 -0
- data/test/plugin/test_parser_syslog.rb +242 -0
- data/test/plugin/test_parser_tsv.rb +122 -0
- data/test/plugin/test_storage.rb +167 -0
- data/test/plugin/test_storage_local.rb +335 -0
- data/test/plugin/test_string_util.rb +26 -0
- data/test/plugin_helper/test_child_process.rb +794 -0
- data/test/plugin_helper/test_compat_parameters.rb +331 -0
- data/test/plugin_helper/test_event_emitter.rb +51 -0
- data/test/plugin_helper/test_event_loop.rb +52 -0
- data/test/plugin_helper/test_extract.rb +194 -0
- data/test/plugin_helper/test_formatter.rb +255 -0
- data/test/plugin_helper/test_inject.rb +519 -0
- data/test/plugin_helper/test_parser.rb +264 -0
- data/test/plugin_helper/test_retry_state.rb +422 -0
- data/test/plugin_helper/test_server.rb +1677 -0
- data/test/plugin_helper/test_storage.rb +542 -0
- data/test/plugin_helper/test_thread.rb +164 -0
- data/test/plugin_helper/test_timer.rb +132 -0
- data/test/scripts/exec_script.rb +32 -0
- data/test/scripts/fluent/plugin/formatter1/formatter_test1.rb +7 -0
- data/test/scripts/fluent/plugin/formatter2/formatter_test2.rb +7 -0
- data/test/scripts/fluent/plugin/formatter_known.rb +8 -0
- data/test/scripts/fluent/plugin/out_test.rb +81 -0
- data/test/scripts/fluent/plugin/out_test2.rb +80 -0
- data/test/scripts/fluent/plugin/parser_known.rb +4 -0
- data/test/test_clock.rb +164 -0
- data/test/test_config.rb +179 -0
- data/test/test_configdsl.rb +148 -0
- data/test/test_event.rb +515 -0
- data/test/test_event_router.rb +331 -0
- data/test/test_event_time.rb +186 -0
- data/test/test_filter.rb +121 -0
- data/test/test_formatter.rb +312 -0
- data/test/test_input.rb +31 -0
- data/test/test_log.rb +828 -0
- data/test/test_match.rb +137 -0
- data/test/test_mixin.rb +351 -0
- data/test/test_output.rb +273 -0
- data/test/test_plugin.rb +251 -0
- data/test/test_plugin_classes.rb +253 -0
- data/test/test_plugin_helper.rb +81 -0
- data/test/test_plugin_id.rb +101 -0
- data/test/test_process.rb +14 -0
- data/test/test_root_agent.rb +611 -0
- data/test/test_supervisor.rb +373 -0
- data/test/test_test_drivers.rb +135 -0
- data/test/test_time_formatter.rb +282 -0
- data/test/test_time_parser.rb +211 -0
- data/test/test_unique_id.rb +47 -0
- metadata +898 -0
data/fluentd.gemspec
ADDED
@@ -0,0 +1,51 @@
|
|
1
|
+
require File.expand_path('../lib/fluent/version', __FILE__)
|
2
|
+
|
3
|
+
Gem::Specification.new do |gem|
|
4
|
+
gem.name = "fluentd-hubspot"
|
5
|
+
gem.version = Fluent::VERSION # see lib/fluent/version.rb
|
6
|
+
|
7
|
+
gem.authors = ["Sadayuki Furuhashi"]
|
8
|
+
gem.email = ["frsyuki@gmail.com"]
|
9
|
+
gem.description = %q{Fluentd is an open source data collector designed to scale and simplify log management. It can collect, process and ship many kinds of data in near real-time.}
|
10
|
+
gem.summary = %q{Fluentd event collector}
|
11
|
+
gem.homepage = "http://fluentd.org/"
|
12
|
+
|
13
|
+
gem.files = `git ls-files`.split($\)
|
14
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
15
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
16
|
+
gem.require_paths = ["lib"]
|
17
|
+
gem.has_rdoc = false
|
18
|
+
gem.license = "Apache-2.0"
|
19
|
+
|
20
|
+
gem.required_ruby_version = '>= 2.1'
|
21
|
+
|
22
|
+
gem.add_runtime_dependency("msgpack", [">= 0.7.0", "< 2.0.0"])
|
23
|
+
gem.add_runtime_dependency("yajl-ruby", ["~> 1.0"])
|
24
|
+
gem.add_runtime_dependency("cool.io", ["~> 1.4.5"])
|
25
|
+
gem.add_runtime_dependency("serverengine", [">= 2.0.4", "< 3.0.0"])
|
26
|
+
gem.add_runtime_dependency("http_parser.rb", [">= 0.5.1", "< 0.7.0"])
|
27
|
+
gem.add_runtime_dependency("sigdump", ["~> 0.2.2"])
|
28
|
+
gem.add_runtime_dependency("tzinfo", ["~> 1.0"])
|
29
|
+
gem.add_runtime_dependency("tzinfo-data", ["~> 1.0"])
|
30
|
+
gem.add_runtime_dependency("strptime", ["~> 0.1.7"])
|
31
|
+
|
32
|
+
# build gem for a certain platform. see also Rakefile
|
33
|
+
fake_platform = ENV['GEM_BUILD_FAKE_PLATFORM'].to_s
|
34
|
+
gem.platform = fake_platform unless fake_platform.empty?
|
35
|
+
if /mswin|mingw/ =~ fake_platform || (/mswin|mingw/ =~ RUBY_PLATFORM && fake_platform.empty?)
|
36
|
+
gem.add_runtime_dependency("win32-service", ["~> 0.8.3"])
|
37
|
+
gem.add_runtime_dependency("win32-ipc", ["~> 0.6.1"])
|
38
|
+
gem.add_runtime_dependency("win32-event", ["~> 0.6.1"])
|
39
|
+
gem.add_runtime_dependency("windows-pr", ["~> 1.2.5"])
|
40
|
+
end
|
41
|
+
|
42
|
+
gem.add_development_dependency("rake", ["~> 11.0"])
|
43
|
+
gem.add_development_dependency("flexmock", ["~> 2.0"])
|
44
|
+
gem.add_development_dependency("parallel_tests", ["~> 0.15.3"])
|
45
|
+
gem.add_development_dependency("simplecov", ["~> 0.7"])
|
46
|
+
gem.add_development_dependency("rr", ["~> 1.0"])
|
47
|
+
gem.add_development_dependency("timecop", ["~> 0.3"])
|
48
|
+
gem.add_development_dependency("test-unit", ["~> 3.2"])
|
49
|
+
gem.add_development_dependency("test-unit-rr", ["~> 1.0"])
|
50
|
+
gem.add_development_dependency("oj", ["~> 2.14"])
|
51
|
+
end
|
data/lib/fluent/agent.rb
ADDED
@@ -0,0 +1,163 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'fluent/configurable'
|
18
|
+
require 'fluent/plugin'
|
19
|
+
require 'fluent/output'
|
20
|
+
require 'fluent/match'
|
21
|
+
|
22
|
+
module Fluent
|
23
|
+
#
|
24
|
+
# Agent is a resource unit who manages emittable plugins
|
25
|
+
#
|
26
|
+
# Next step: `fluentd/root_agent.rb`
|
27
|
+
# Next step: `fluentd/label.rb`
|
28
|
+
#
|
29
|
+
class Agent
|
30
|
+
include Configurable
|
31
|
+
|
32
|
+
def initialize(log:)
|
33
|
+
super()
|
34
|
+
|
35
|
+
@context = nil
|
36
|
+
@outputs = []
|
37
|
+
@filters = []
|
38
|
+
|
39
|
+
@lifecycle_control_list = nil
|
40
|
+
# lifecycle_control_list is the list of plugins in this agent, and ordered
|
41
|
+
# from plugins which DOES emit, then DOESN'T emit
|
42
|
+
# (input -> output w/ router -> filter -> output w/o router)
|
43
|
+
# for start: use this order DESC
|
44
|
+
# (because plugins which appears later in configurations will receive events from plugins which appears ealier)
|
45
|
+
# for stop/before_shutdown/shutdown/after_shutdown/close/terminate: use this order ASC
|
46
|
+
@lifecycle_cache = nil
|
47
|
+
|
48
|
+
@log = log
|
49
|
+
@event_router = EventRouter.new(NoMatchMatch.new(log), self)
|
50
|
+
@error_collector = nil
|
51
|
+
end
|
52
|
+
|
53
|
+
attr_reader :log
|
54
|
+
attr_reader :outputs
|
55
|
+
attr_reader :filters
|
56
|
+
attr_reader :context
|
57
|
+
attr_reader :event_router
|
58
|
+
attr_reader :error_collector
|
59
|
+
|
60
|
+
def configure(conf)
|
61
|
+
super
|
62
|
+
|
63
|
+
# initialize <match> and <filter> elements
|
64
|
+
conf.elements('filter', 'match').each { |e|
|
65
|
+
pattern = e.arg.empty? ? '**' : e.arg
|
66
|
+
type = e['@type']
|
67
|
+
raise ConfigError, "Missing '@type' parameter on <#{e.name}> directive" unless type
|
68
|
+
if e.name == 'filter'
|
69
|
+
add_filter(type, pattern, e)
|
70
|
+
else
|
71
|
+
add_match(type, pattern, e)
|
72
|
+
end
|
73
|
+
}
|
74
|
+
end
|
75
|
+
|
76
|
+
def lifecycle_control_list
|
77
|
+
return @lifecycle_control_list if @lifecycle_control_list
|
78
|
+
|
79
|
+
lifecycle_control_list = {
|
80
|
+
input: [],
|
81
|
+
output_with_router: [],
|
82
|
+
filter: [],
|
83
|
+
output: [],
|
84
|
+
}
|
85
|
+
if self.respond_to?(:inputs)
|
86
|
+
inputs.each do |i|
|
87
|
+
lifecycle_control_list[:input] << i
|
88
|
+
end
|
89
|
+
end
|
90
|
+
outputs.each do |o|
|
91
|
+
if o.has_router?
|
92
|
+
lifecycle_control_list[:output_with_router] << o
|
93
|
+
else
|
94
|
+
lifecycle_control_list[:output] << o
|
95
|
+
end
|
96
|
+
end
|
97
|
+
filters.each do |f|
|
98
|
+
lifecycle_control_list[:filter] << f
|
99
|
+
end
|
100
|
+
|
101
|
+
@lifecycle_control_list = lifecycle_control_list
|
102
|
+
end
|
103
|
+
|
104
|
+
def lifecycle(desc: false)
|
105
|
+
kind_list = if desc
|
106
|
+
[:output, :filter, :output_with_router]
|
107
|
+
else
|
108
|
+
[:output_with_router, :filter, :output]
|
109
|
+
end
|
110
|
+
kind_list.each do |kind|
|
111
|
+
list = if desc
|
112
|
+
lifecycle_control_list[kind].reverse
|
113
|
+
else
|
114
|
+
lifecycle_control_list[kind]
|
115
|
+
end
|
116
|
+
display_kind = (kind == :output_with_router ? :output : kind)
|
117
|
+
list.each do |instance|
|
118
|
+
yield instance, display_kind
|
119
|
+
end
|
120
|
+
end
|
121
|
+
end
|
122
|
+
|
123
|
+
def add_match(type, pattern, conf)
|
124
|
+
log.info :worker0, "adding match#{@context.nil? ? '' : " in #{@context}"}", pattern: pattern, type: type
|
125
|
+
|
126
|
+
output = Plugin.new_output(type)
|
127
|
+
output.context_router = @event_router
|
128
|
+
output.configure(conf)
|
129
|
+
@outputs << output
|
130
|
+
if output.respond_to?(:outputs) && output.respond_to?(:multi_output?) && output.multi_output?
|
131
|
+
# TODO: ruby 2.3 or later: replace `output.respond_to?(:multi_output?) && output.multi_output?` with output&.multi_output?
|
132
|
+
outputs = if output.respond_to?(:static_outputs)
|
133
|
+
output.static_outputs
|
134
|
+
else
|
135
|
+
output.outputs
|
136
|
+
end
|
137
|
+
@outputs.push(*outputs)
|
138
|
+
end
|
139
|
+
@event_router.add_rule(pattern, output)
|
140
|
+
|
141
|
+
output
|
142
|
+
end
|
143
|
+
|
144
|
+
def add_filter(type, pattern, conf)
|
145
|
+
log.info :worker0, "adding filter#{@context.nil? ? '' : " in #{@context}"}", pattern: pattern, type: type
|
146
|
+
|
147
|
+
filter = Plugin.new_filter(type)
|
148
|
+
filter.context_router = @event_router
|
149
|
+
filter.configure(conf)
|
150
|
+
@filters << filter
|
151
|
+
@event_router.add_rule(pattern, filter)
|
152
|
+
|
153
|
+
filter
|
154
|
+
end
|
155
|
+
|
156
|
+
# For handling invalid record
|
157
|
+
def emit_error_event(tag, time, record, error)
|
158
|
+
end
|
159
|
+
|
160
|
+
def handle_emits_error(tag, es, error)
|
161
|
+
end
|
162
|
+
end
|
163
|
+
end
|
data/lib/fluent/clock.rb
ADDED
@@ -0,0 +1,62 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
module Fluent
|
18
|
+
module Clock
|
19
|
+
CLOCK_ID = Process::CLOCK_MONOTONIC_RAW rescue Process::CLOCK_MONOTONIC
|
20
|
+
|
21
|
+
@@block_level = 0
|
22
|
+
@@frozen_clock = nil
|
23
|
+
|
24
|
+
def self.now
|
25
|
+
@@frozen_clock || now_raw
|
26
|
+
end
|
27
|
+
|
28
|
+
def self.freeze(dst = nil, &block)
|
29
|
+
return freeze_block(dst, &block) if block_given?
|
30
|
+
|
31
|
+
dst = dst_clock_from_time(dst) if dst.is_a?(Time)
|
32
|
+
@@frozen_clock = dst || now_raw
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.return
|
36
|
+
raise "invalid return while running code in blocks" if @@block_level > 0
|
37
|
+
@@frozen_clock = nil
|
38
|
+
end
|
39
|
+
|
40
|
+
# internal use
|
41
|
+
|
42
|
+
def self.now_raw
|
43
|
+
Process.clock_gettime(CLOCK_ID)
|
44
|
+
end
|
45
|
+
|
46
|
+
def self.dst_clock_from_time(time)
|
47
|
+
diff_sec = Time.now - time
|
48
|
+
now_raw - diff_sec
|
49
|
+
end
|
50
|
+
|
51
|
+
def self.freeze_block(dst)
|
52
|
+
dst = dst_clock_from_time(dst) if dst.is_a?(Time)
|
53
|
+
pre_frozen_clock = @@frozen_clock
|
54
|
+
@@frozen_clock = dst || now_raw
|
55
|
+
@@block_level += 1
|
56
|
+
yield
|
57
|
+
ensure
|
58
|
+
@@block_level -= 1
|
59
|
+
@@frozen_clock = pre_frozen_clock
|
60
|
+
end
|
61
|
+
end
|
62
|
+
end
|
@@ -0,0 +1,234 @@
|
|
1
|
+
#
|
2
|
+
# Fluentd
|
3
|
+
#
|
4
|
+
# Licensed under the Apache License, Version 2.0 (the "License");
|
5
|
+
# you may not use this file except in compliance with the License.
|
6
|
+
# You may obtain a copy of the License at
|
7
|
+
#
|
8
|
+
# http://www.apache.org/licenses/LICENSE-2.0
|
9
|
+
#
|
10
|
+
# Unless required by applicable law or agreed to in writing, software
|
11
|
+
# distributed under the License is distributed on an "AS IS" BASIS,
|
12
|
+
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
13
|
+
# See the License for the specific language governing permissions and
|
14
|
+
# limitations under the License.
|
15
|
+
#
|
16
|
+
|
17
|
+
require 'optparse'
|
18
|
+
require 'msgpack'
|
19
|
+
|
20
|
+
require 'fluent/msgpack_factory'
|
21
|
+
require 'fluent/formatter'
|
22
|
+
require 'fluent/plugin'
|
23
|
+
require 'fluent/config/element'
|
24
|
+
|
25
|
+
class FluentBinlogReader
|
26
|
+
SUBCOMMAND = %w(cat head formats)
|
27
|
+
HELP_TEXT = <<HELP
|
28
|
+
Usage: fluent-binlog-reader <command> [<args>]
|
29
|
+
|
30
|
+
Commands of fluent-binlog-reader:
|
31
|
+
cat : Read files sequentially, writing them to standard output.
|
32
|
+
head : Display the beginning of a text file.
|
33
|
+
format : Display plugins that you can use.
|
34
|
+
|
35
|
+
See 'fluent-binlog-reader <command> --help' for more information on a specific command.
|
36
|
+
HELP
|
37
|
+
|
38
|
+
def initialize(argv = ARGV)
|
39
|
+
@argv = argv
|
40
|
+
end
|
41
|
+
|
42
|
+
def call
|
43
|
+
command_class = BinlogReaderCommand.const_get(command)
|
44
|
+
command_class.new(@argv).call
|
45
|
+
end
|
46
|
+
|
47
|
+
private
|
48
|
+
|
49
|
+
def command
|
50
|
+
command = @argv.shift
|
51
|
+
if !command || !SUBCOMMAND.include?(command)
|
52
|
+
usage "Required subcommand : #{SUBCOMMAND.join(' | ')}"
|
53
|
+
end
|
54
|
+
|
55
|
+
command.split('_').map(&:capitalize).join('')
|
56
|
+
end
|
57
|
+
|
58
|
+
def usage(msg = nil)
|
59
|
+
puts HELP_TEXT
|
60
|
+
puts "Error: #{msg}" if msg
|
61
|
+
exit 1
|
62
|
+
end
|
63
|
+
end
|
64
|
+
|
65
|
+
module BinlogReaderCommand
|
66
|
+
class Base
|
67
|
+
def initialize(argv = ARGV)
|
68
|
+
@argv = argv
|
69
|
+
|
70
|
+
@options = { plugin: [] }
|
71
|
+
@opt_parser = OptionParser.new do |opt|
|
72
|
+
opt.separator 'Options:'
|
73
|
+
|
74
|
+
opt.on('-p DIR', '--plugin', 'add library directory path') do |v|
|
75
|
+
@options[:plugin] << v
|
76
|
+
end
|
77
|
+
end
|
78
|
+
end
|
79
|
+
|
80
|
+
def call
|
81
|
+
raise NotImplementedError, 'BUG: command MUST implement this method'
|
82
|
+
end
|
83
|
+
|
84
|
+
private
|
85
|
+
|
86
|
+
def usage(msg = nil)
|
87
|
+
puts @opt_parser.to_s
|
88
|
+
puts "Error: #{msg}" if msg
|
89
|
+
exit 1
|
90
|
+
end
|
91
|
+
|
92
|
+
def parse_options!
|
93
|
+
@opt_parser.parse!(@argv)
|
94
|
+
|
95
|
+
unless @options[:plugin].empty?
|
96
|
+
if dir = @options[:plugin].find { |d| !Dir.exist?(d) }
|
97
|
+
usage "Directory #{dir} doesn't exist"
|
98
|
+
else
|
99
|
+
@options[:plugin].each do |d|
|
100
|
+
Fluent::Plugin.add_plugin_dir(d)
|
101
|
+
end
|
102
|
+
end
|
103
|
+
end
|
104
|
+
rescue => e
|
105
|
+
usage e
|
106
|
+
end
|
107
|
+
end
|
108
|
+
|
109
|
+
module Formattable
|
110
|
+
DEFAULT_OPTIONS = {
|
111
|
+
format: :out_file
|
112
|
+
}
|
113
|
+
|
114
|
+
def initialize(argv = ARGV)
|
115
|
+
super
|
116
|
+
@options.merge!(DEFAULT_OPTIONS)
|
117
|
+
configure_option_parser
|
118
|
+
end
|
119
|
+
|
120
|
+
private
|
121
|
+
|
122
|
+
def configure_option_parser
|
123
|
+
@options.merge!(config_params: {})
|
124
|
+
|
125
|
+
@opt_parser.banner = "Usage: fluent-binlog-reader #{self.class.to_s.split('::').last.downcase} [options] file"
|
126
|
+
|
127
|
+
@opt_parser.on('-f TYPE', '--format', 'configure output format') do |v|
|
128
|
+
@options[:format] = v.to_sym
|
129
|
+
end
|
130
|
+
|
131
|
+
@opt_parser.on('-e KEY=VALUE', 'configure formatter config params') do |v|
|
132
|
+
key, value = v.split('=')
|
133
|
+
usage "#{v} is invalid. valid format is like `key=value`" unless value
|
134
|
+
@options[:config_params].merge!(key => value)
|
135
|
+
end
|
136
|
+
end
|
137
|
+
|
138
|
+
def lookup_formatter(format, params)
|
139
|
+
conf = Fluent::Config::Element.new('ROOT', '', params, [])
|
140
|
+
formatter = Fluent::Plugin.new_formatter(format)
|
141
|
+
|
142
|
+
if formatter.respond_to?(:configure)
|
143
|
+
formatter.configure(conf)
|
144
|
+
end
|
145
|
+
formatter
|
146
|
+
rescue => e
|
147
|
+
usage e
|
148
|
+
end
|
149
|
+
end
|
150
|
+
|
151
|
+
class Head < Base
|
152
|
+
include Formattable
|
153
|
+
|
154
|
+
DEFAULT_HEAD_OPTIONS = {
|
155
|
+
count: 5
|
156
|
+
}
|
157
|
+
|
158
|
+
def initialize(argv = ARGV)
|
159
|
+
super
|
160
|
+
@options.merge!(default_options)
|
161
|
+
parse_options!
|
162
|
+
end
|
163
|
+
|
164
|
+
def call
|
165
|
+
@formatter = lookup_formatter(@options[:format], @options[:config_params])
|
166
|
+
|
167
|
+
File.open(@path, 'rb') do |io|
|
168
|
+
i = 1
|
169
|
+
Fluent::MessagePackFactory.unpacker(io).each do |(time, record)|
|
170
|
+
print @formatter.format(@path, time, record) # path is used for tag
|
171
|
+
break if @options[:count] && i == @options[:count]
|
172
|
+
i += 1
|
173
|
+
end
|
174
|
+
end
|
175
|
+
end
|
176
|
+
|
177
|
+
private
|
178
|
+
|
179
|
+
def default_options
|
180
|
+
DEFAULT_HEAD_OPTIONS
|
181
|
+
end
|
182
|
+
|
183
|
+
def parse_options!
|
184
|
+
@opt_parser.on('-n COUNT', 'Set the number of lines to display') do |v|
|
185
|
+
@options[:count] = v.to_i
|
186
|
+
usage "illegal line count -- #{@options[:count]}" if @options[:count] < 1
|
187
|
+
end
|
188
|
+
|
189
|
+
super
|
190
|
+
|
191
|
+
usage 'Path is required' if @argv.empty?
|
192
|
+
@path = @argv.first
|
193
|
+
usage "#{@path} is not found" unless File.exist?(@path)
|
194
|
+
end
|
195
|
+
end
|
196
|
+
|
197
|
+
class Cat < Head
|
198
|
+
DEFAULT_CAT_OPTIONS = {
|
199
|
+
count: nil # Overwrite DEFAULT_HEAD_OPTIONS[:count]
|
200
|
+
}
|
201
|
+
|
202
|
+
def default_options
|
203
|
+
DEFAULT_CAT_OPTIONS
|
204
|
+
end
|
205
|
+
end
|
206
|
+
|
207
|
+
class Formats < Base
|
208
|
+
def initialize(argv = ARGV)
|
209
|
+
super
|
210
|
+
parse_options!
|
211
|
+
end
|
212
|
+
|
213
|
+
def call
|
214
|
+
prefix = Fluent::Plugin::FORMATTER_REGISTRY.dir_search_prefix || 'formatter_'
|
215
|
+
|
216
|
+
plugin_dirs = @options[:plugin]
|
217
|
+
unless plugin_dirs.empty?
|
218
|
+
plugin_dirs.each do |d|
|
219
|
+
Dir.glob("#{d}/#{prefix}*.rb").each do |path|
|
220
|
+
require File.absolute_path(path)
|
221
|
+
end
|
222
|
+
end
|
223
|
+
end
|
224
|
+
|
225
|
+
$LOAD_PATH.map do |lp|
|
226
|
+
Dir.glob("#{lp}/#{prefix}*.rb").each do |path|
|
227
|
+
require path
|
228
|
+
end
|
229
|
+
end
|
230
|
+
|
231
|
+
puts Fluent::Plugin::FORMATTER_REGISTRY.map.keys
|
232
|
+
end
|
233
|
+
end
|
234
|
+
end
|