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
@@ -0,0 +1,301 @@
|
|
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
|
+
|
19
|
+
require 'fluent/supervisor'
|
20
|
+
require 'fluent/log'
|
21
|
+
require 'fluent/env'
|
22
|
+
require 'fluent/version'
|
23
|
+
|
24
|
+
$fluentdargv = Marshal.load(Marshal.dump(ARGV))
|
25
|
+
|
26
|
+
op = OptionParser.new
|
27
|
+
op.version = Fluent::VERSION
|
28
|
+
|
29
|
+
opts = Fluent::Supervisor.default_options
|
30
|
+
|
31
|
+
op.on('-s', "--setup [DIR=#{File.dirname(Fluent::DEFAULT_CONFIG_PATH)}]", "install sample configuration file to the directory") {|s|
|
32
|
+
opts[:setup_path] = s || File.dirname(Fluent::DEFAULT_CONFIG_PATH)
|
33
|
+
}
|
34
|
+
|
35
|
+
op.on('-c', '--config PATH', "config file path (default: #{Fluent::DEFAULT_CONFIG_PATH})") {|s|
|
36
|
+
opts[:config_path] = s
|
37
|
+
}
|
38
|
+
|
39
|
+
op.on('--dry-run', "Check fluentd setup is correct or not", TrueClass) {|b|
|
40
|
+
opts[:dry_run] = b
|
41
|
+
}
|
42
|
+
|
43
|
+
op.on('--show-plugin-config=PLUGIN', "Show PLUGIN configuration and exit(ex: input:dummy)") {|plugin|
|
44
|
+
opts[:show_plugin_config] = plugin
|
45
|
+
}
|
46
|
+
|
47
|
+
op.on('-p', '--plugin DIR', "add plugin directory") {|s|
|
48
|
+
opts[:plugin_dirs] << s
|
49
|
+
}
|
50
|
+
|
51
|
+
op.on('-I PATH', "add library path") {|s|
|
52
|
+
$LOAD_PATH << s
|
53
|
+
}
|
54
|
+
|
55
|
+
op.on('-r NAME', "load library") {|s|
|
56
|
+
opts[:libs] << s
|
57
|
+
}
|
58
|
+
|
59
|
+
op.on('-d', '--daemon PIDFILE', "daemonize fluent process") {|s|
|
60
|
+
opts[:daemonize] = s
|
61
|
+
}
|
62
|
+
|
63
|
+
op.on('--under-supervisor', "run fluent worker under supervisor (this option is NOT for users)") {
|
64
|
+
opts[:supervise] = false
|
65
|
+
}
|
66
|
+
|
67
|
+
op.on('--no-supervisor', "run fluent worker without supervisor") {
|
68
|
+
opts[:supervise] = false
|
69
|
+
opts[:standalone_worker] = true
|
70
|
+
}
|
71
|
+
|
72
|
+
op.on('--workers NUM', "specify the number of workers under supervisor") { |i|
|
73
|
+
opts[:workers] = i.to_i
|
74
|
+
}
|
75
|
+
|
76
|
+
op.on('--user USER', "change user") {|s|
|
77
|
+
opts[:chuser] = s
|
78
|
+
}
|
79
|
+
|
80
|
+
op.on('--group GROUP', "change group") {|s|
|
81
|
+
opts[:chgroup] = s
|
82
|
+
}
|
83
|
+
|
84
|
+
op.on('-o', '--log PATH', "log file path") {|s|
|
85
|
+
opts[:log_path] = s
|
86
|
+
}
|
87
|
+
|
88
|
+
ROTATE_AGE = %w(daily weekly monthly)
|
89
|
+
op.on('--log-rotate-age AGE', 'generations to keep rotated log files') {|age|
|
90
|
+
if ROTATE_AGE.include?(age)
|
91
|
+
opts[:log_rotate_age] = age
|
92
|
+
else
|
93
|
+
begin
|
94
|
+
opts[:log_rotate_age] = Integer(age)
|
95
|
+
rescue TypeError
|
96
|
+
usage "log-rotate-age should be #{rotate_ages.join(', ')} or a number"
|
97
|
+
end
|
98
|
+
end
|
99
|
+
}
|
100
|
+
|
101
|
+
op.on('--log-rotate-size BYTES', 'sets the byte size to rotate log files') {|s|
|
102
|
+
opts[:log_rotate_size] = s.to_i
|
103
|
+
}
|
104
|
+
|
105
|
+
op.on('--log-event-verbose', 'enable log events during process startup/shutdown') {|b|
|
106
|
+
opts[:log_event_verbose] = b
|
107
|
+
}
|
108
|
+
|
109
|
+
op.on('-i', '--inline-config CONFIG_STRING', "inline config which is appended to the config file on-the-fly") {|s|
|
110
|
+
opts[:inline_config] = s
|
111
|
+
}
|
112
|
+
|
113
|
+
op.on('--emit-error-log-interval SECONDS', "suppress interval seconds of emit error logs") {|s|
|
114
|
+
opts[:suppress_interval] = s.to_i
|
115
|
+
}
|
116
|
+
|
117
|
+
op.on('--suppress-repeated-stacktrace [VALUE]', "suppress repeated stacktrace", TrueClass) {|b|
|
118
|
+
b = true if b.nil?
|
119
|
+
opts[:suppress_repeated_stacktrace] = b
|
120
|
+
}
|
121
|
+
|
122
|
+
op.on('--without-source', "invoke a fluentd without input plugins", TrueClass) {|b|
|
123
|
+
opts[:without_source] = b
|
124
|
+
}
|
125
|
+
|
126
|
+
op.on('--use-v1-config', "Use v1 configuration format (default)", TrueClass) {|b|
|
127
|
+
opts[:use_v1_config] = b
|
128
|
+
}
|
129
|
+
|
130
|
+
op.on('--use-v0-config', "Use v0 configuration format", TrueClass) {|b|
|
131
|
+
opts[:use_v1_config] = !b
|
132
|
+
}
|
133
|
+
|
134
|
+
op.on('-v', '--verbose', "increase verbose level (-v: debug, -vv: trace)", TrueClass) {|b|
|
135
|
+
if b
|
136
|
+
opts[:log_level] = [opts[:log_level] - 1, Fluent::Log::LEVEL_TRACE].max
|
137
|
+
end
|
138
|
+
}
|
139
|
+
|
140
|
+
op.on('-q', '--quiet', "decrease verbose level (-q: warn, -qq: error)", TrueClass) {|b|
|
141
|
+
if b
|
142
|
+
opts[:log_level] = [opts[:log_level] + 1, Fluent::Log::LEVEL_ERROR].min
|
143
|
+
end
|
144
|
+
}
|
145
|
+
|
146
|
+
op.on('--suppress-config-dump', "suppress config dumping when fluentd starts", TrueClass) {|b|
|
147
|
+
opts[:suppress_config_dump] = b
|
148
|
+
}
|
149
|
+
|
150
|
+
op.on('-g', '--gemfile GEMFILE', "Gemfile path") {|s|
|
151
|
+
opts[:gemfile] = s
|
152
|
+
}
|
153
|
+
|
154
|
+
op.on('-G', '--gem-path GEM_INSTALL_PATH', "Gemfile install path (default: $(dirname $gemfile)/vendor/bundle)") {|s|
|
155
|
+
opts[:gem_install_path] = s
|
156
|
+
}
|
157
|
+
|
158
|
+
if Fluent.windows?
|
159
|
+
require 'windows/library'
|
160
|
+
include Windows::Library
|
161
|
+
|
162
|
+
op.on('-x', '--signame INTSIGNAME', "an object name which is used for Windows Service signal (Windows only)") {|s|
|
163
|
+
opts[:signame] = s
|
164
|
+
}
|
165
|
+
|
166
|
+
op.on('--reg-winsvc MODE', "install/uninstall as Windows Service. (i: install, u: uninstall) (Windows only)") {|s|
|
167
|
+
opts[:regwinsvc] = s
|
168
|
+
}
|
169
|
+
|
170
|
+
op.on('--[no-]reg-winsvc-auto-start', "Automatically start the Windows Service at boot. (only effective with '--reg-winsvc i') (Windows only)") {|s|
|
171
|
+
opts[:regwinsvcautostart] = s
|
172
|
+
}
|
173
|
+
|
174
|
+
op.on('--reg-winsvc-fluentdopt OPTION', "specify fluentd option paramters for Windows Service. (Windows only)") {|s|
|
175
|
+
opts[:fluentdopt] = s
|
176
|
+
}
|
177
|
+
end
|
178
|
+
|
179
|
+
|
180
|
+
(class << self; self; end).module_eval do
|
181
|
+
define_method(:usage) do |msg|
|
182
|
+
puts op.to_s
|
183
|
+
puts "error: #{msg}" if msg
|
184
|
+
exit 1
|
185
|
+
end
|
186
|
+
end
|
187
|
+
|
188
|
+
begin
|
189
|
+
rest = op.parse(ARGV)
|
190
|
+
|
191
|
+
if rest.length != 0
|
192
|
+
usage nil
|
193
|
+
end
|
194
|
+
rescue
|
195
|
+
usage $!.to_s
|
196
|
+
end
|
197
|
+
|
198
|
+
|
199
|
+
##
|
200
|
+
## Bundler injection
|
201
|
+
#
|
202
|
+
if ENV['FLUENTD_DISABLE_BUNDLER_INJECTION'] != '1' && gemfile = opts[:gemfile]
|
203
|
+
ENV['BUNDLE_GEMFILE'] = gemfile
|
204
|
+
if path = opts[:gem_install_path]
|
205
|
+
ENV['BUNDLE_PATH'] = path
|
206
|
+
else
|
207
|
+
ENV['BUNDLE_PATH'] = File.expand_path(File.join(File.dirname(gemfile), 'vendor/bundle'))
|
208
|
+
end
|
209
|
+
ENV['FLUENTD_DISABLE_BUNDLER_INJECTION'] = '1'
|
210
|
+
load File.expand_path(File.join(File.dirname(__FILE__), 'bundler_injection.rb'))
|
211
|
+
end
|
212
|
+
|
213
|
+
if setup_path = opts[:setup_path]
|
214
|
+
require 'fileutils'
|
215
|
+
FileUtils.mkdir_p File.join(setup_path, "plugin")
|
216
|
+
confpath = File.join(setup_path, "fluent.conf")
|
217
|
+
if File.exist?(confpath)
|
218
|
+
puts "#{confpath} already exists."
|
219
|
+
else
|
220
|
+
File.open(confpath, "w") {|f|
|
221
|
+
conf = File.read File.join(File.dirname(__FILE__), "..", "..", "..", "fluent.conf")
|
222
|
+
f.write conf
|
223
|
+
}
|
224
|
+
puts "Installed #{confpath}."
|
225
|
+
end
|
226
|
+
exit 0
|
227
|
+
end
|
228
|
+
|
229
|
+
early_exit = false
|
230
|
+
start_service = false
|
231
|
+
if winsvcinstmode = opts[:regwinsvc]
|
232
|
+
FLUENTD_WINSVC_NAME="fluentdwinsvc"
|
233
|
+
FLUENTD_WINSVC_DISPLAYNAME="Fluentd Windows Service"
|
234
|
+
FLUENTD_WINSVC_DESC="Fluentd is an event collector system."
|
235
|
+
require 'fileutils'
|
236
|
+
require "win32/service"
|
237
|
+
require "win32/registry"
|
238
|
+
include Win32
|
239
|
+
|
240
|
+
case winsvcinstmode
|
241
|
+
when 'i'
|
242
|
+
binary_path = File.join(File.dirname(__FILE__), "..")
|
243
|
+
ruby_path = "\0" * 256
|
244
|
+
GetModuleFileName.call(0,ruby_path,256)
|
245
|
+
ruby_path = ruby_path.rstrip.gsub(/\\/, '/')
|
246
|
+
start_type = Service::DEMAND_START
|
247
|
+
if opts[:regwinsvcautostart]
|
248
|
+
start_type = Service::AUTO_START
|
249
|
+
start_service = true
|
250
|
+
end
|
251
|
+
|
252
|
+
Service.create(
|
253
|
+
service_name: FLUENTD_WINSVC_NAME,
|
254
|
+
host: nil,
|
255
|
+
service_type: Service::WIN32_OWN_PROCESS,
|
256
|
+
description: FLUENTD_WINSVC_DESC,
|
257
|
+
start_type: start_type,
|
258
|
+
error_control: Service::ERROR_NORMAL,
|
259
|
+
binary_path_name: ruby_path+" -C "+binary_path+" winsvc.rb",
|
260
|
+
load_order_group: "",
|
261
|
+
dependencies: [""],
|
262
|
+
display_name: FLUENTD_WINSVC_DISPLAYNAME
|
263
|
+
)
|
264
|
+
when 'u'
|
265
|
+
if Service.status(FLUENTD_WINSVC_NAME).current_state != 'stopped'
|
266
|
+
begin
|
267
|
+
Service.stop(FLUENTD_WINSVC_NAME)
|
268
|
+
rescue => ex
|
269
|
+
puts "Warning: Failed to stop service: ", ex
|
270
|
+
end
|
271
|
+
end
|
272
|
+
Service.delete(FLUENTD_WINSVC_NAME)
|
273
|
+
else
|
274
|
+
# none
|
275
|
+
end
|
276
|
+
early_exit = true
|
277
|
+
end
|
278
|
+
|
279
|
+
if fluentdopt = opts[:fluentdopt]
|
280
|
+
Win32::Registry::HKEY_LOCAL_MACHINE.open("SYSTEM\\CurrentControlSet\\Services\\fluentdwinsvc", Win32::Registry::KEY_ALL_ACCESS) do |reg|
|
281
|
+
reg['fluentdopt', Win32::Registry::REG_SZ] = fluentdopt
|
282
|
+
end
|
283
|
+
early_exit = true
|
284
|
+
end
|
285
|
+
|
286
|
+
if start_service
|
287
|
+
Service.start(FLUENTD_WINSVC_NAME)
|
288
|
+
end
|
289
|
+
|
290
|
+
exit 0 if early_exit
|
291
|
+
|
292
|
+
require 'fluent/supervisor'
|
293
|
+
if opts[:supervise]
|
294
|
+
Fluent::Supervisor.new(opts).run_supervisor
|
295
|
+
else
|
296
|
+
if opts[:standalone_worker] && opts[:workers] && opts[:workers] > 1
|
297
|
+
puts "Error: multi workers is not supported with --no-supervisor"
|
298
|
+
exit 2
|
299
|
+
end
|
300
|
+
Fluent::Supervisor.new(opts).run_worker
|
301
|
+
end
|
@@ -0,0 +1,258 @@
|
|
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 "erb"
|
18
|
+
require "optparse"
|
19
|
+
require "pathname"
|
20
|
+
require "fluent/plugin"
|
21
|
+
require "fluent/env"
|
22
|
+
require "fluent/engine"
|
23
|
+
require "fluent/system_config"
|
24
|
+
require "fluent/config/element"
|
25
|
+
|
26
|
+
class FluentPluginConfigFormatter
|
27
|
+
|
28
|
+
AVAILABLE_FORMATS = [:markdown, :txt, :json]
|
29
|
+
SUPPORTED_TYPES = [
|
30
|
+
"input", "output", "filter",
|
31
|
+
"buffer", "parser", "formatter", "storage"
|
32
|
+
]
|
33
|
+
|
34
|
+
def initialize(argv = ARGV)
|
35
|
+
@argv = argv
|
36
|
+
|
37
|
+
@compact = false
|
38
|
+
@format = :markdown
|
39
|
+
@verbose = false
|
40
|
+
@libs = []
|
41
|
+
@plugin_dirs = []
|
42
|
+
@options = {}
|
43
|
+
|
44
|
+
prepare_option_parser
|
45
|
+
end
|
46
|
+
|
47
|
+
def call
|
48
|
+
parse_options!
|
49
|
+
init_libraries
|
50
|
+
@plugin = Fluent::Plugin.__send__("new_#{@plugin_type}", @plugin_name)
|
51
|
+
dumped_config = {}
|
52
|
+
if @plugin.class.respond_to?(:plugin_helpers)
|
53
|
+
dumped_config[:plugin_helpers] = @plugin.class.plugin_helpers
|
54
|
+
end
|
55
|
+
@plugin.class.ancestors.reverse_each do |plugin_class|
|
56
|
+
next unless plugin_class.respond_to?(:dump_config_definition)
|
57
|
+
unless @verbose
|
58
|
+
next if plugin_class.name =~ /::PluginHelper::/
|
59
|
+
end
|
60
|
+
dumped_config_definition = plugin_class.dump_config_definition
|
61
|
+
dumped_config[plugin_class.name] = dumped_config_definition unless dumped_config_definition.empty?
|
62
|
+
end
|
63
|
+
case @format
|
64
|
+
when :txt
|
65
|
+
puts dump_txt(dumped_config)
|
66
|
+
when :markdown
|
67
|
+
puts dump_markdown(dumped_config)
|
68
|
+
when :json
|
69
|
+
puts dump_json(dumped_config)
|
70
|
+
end
|
71
|
+
end
|
72
|
+
|
73
|
+
private
|
74
|
+
|
75
|
+
def dump_txt(dumped_config)
|
76
|
+
dumped = ""
|
77
|
+
plugin_helpers = dumped_config.delete(:plugin_helpers)
|
78
|
+
if plugin_helpers && !plugin_helpers.empty?
|
79
|
+
dumped << "helpers: #{plugin_helpers.join(',')}\n"
|
80
|
+
end
|
81
|
+
if @verbose
|
82
|
+
dumped_config.each do |name, config|
|
83
|
+
dumped << "#{name}\n"
|
84
|
+
dumped << dump_section_txt(config)
|
85
|
+
end
|
86
|
+
else
|
87
|
+
configs = dumped_config.values
|
88
|
+
root_section = configs.shift
|
89
|
+
configs.each do |config|
|
90
|
+
root_section.update(config)
|
91
|
+
end
|
92
|
+
dumped << dump_section_txt(root_section)
|
93
|
+
end
|
94
|
+
dumped
|
95
|
+
end
|
96
|
+
|
97
|
+
def dump_section_txt(base_section, level = 0)
|
98
|
+
dumped = ""
|
99
|
+
indent = " " * level
|
100
|
+
if base_section[:section]
|
101
|
+
sections = []
|
102
|
+
params = base_section
|
103
|
+
else
|
104
|
+
sections, params = base_section.partition {|_name, value| value[:section] }
|
105
|
+
end
|
106
|
+
params.each do |name, config|
|
107
|
+
next if name == :section
|
108
|
+
dumped << "#{indent}#{name}: #{config[:type]}: (#{config[:default].inspect})"
|
109
|
+
dumped << " # #{config[:description]}" if config.key?(:description)
|
110
|
+
dumped << "\n"
|
111
|
+
end
|
112
|
+
sections.each do |section_name, sub_section|
|
113
|
+
required = sub_section.delete(:required)
|
114
|
+
multi = sub_section.delete(:multi)
|
115
|
+
alias_name = sub_section.delete(:alias)
|
116
|
+
required_label = required ? "required" : "optional"
|
117
|
+
multi_label = multi ? "multiple" : "single"
|
118
|
+
alias_label = "alias: #{alias_name}"
|
119
|
+
dumped << "#{indent}<#{section_name}>: #{required_label}, #{multi_label}"
|
120
|
+
if alias_name
|
121
|
+
dumped << ", #{alias_label}\n"
|
122
|
+
else
|
123
|
+
dumped << "\n"
|
124
|
+
end
|
125
|
+
sub_section.delete(:section)
|
126
|
+
dumped << dump_section_txt(sub_section, level + 1)
|
127
|
+
end
|
128
|
+
dumped
|
129
|
+
end
|
130
|
+
|
131
|
+
def dump_markdown(dumped_config)
|
132
|
+
dumped = ""
|
133
|
+
plugin_helpers = dumped_config.delete(:plugin_helpers)
|
134
|
+
if plugin_helpers && !plugin_helpers.empty?
|
135
|
+
dumped = "## Plugin helpers\n\n"
|
136
|
+
plugin_helpers.each do |plugin_helper|
|
137
|
+
dumped << "* #{plugin_helper}\n"
|
138
|
+
end
|
139
|
+
dumped << "\n"
|
140
|
+
end
|
141
|
+
dumped_config.each do |name, config|
|
142
|
+
if name == @plugin.class.name
|
143
|
+
dumped << "## #{name}\n\n"
|
144
|
+
dumped << dump_section_markdown(config)
|
145
|
+
else
|
146
|
+
dumped << "* See also: #{name}\n\n"
|
147
|
+
end
|
148
|
+
end
|
149
|
+
dumped
|
150
|
+
end
|
151
|
+
|
152
|
+
def dump_section_markdown(base_section, level = 0)
|
153
|
+
dumped = ""
|
154
|
+
if base_section[:section]
|
155
|
+
sections = []
|
156
|
+
params = base_section
|
157
|
+
else
|
158
|
+
sections, params = base_section.partition {|_name, value| value[:section] }
|
159
|
+
end
|
160
|
+
params.each do |name, config|
|
161
|
+
next if name == :section
|
162
|
+
template_name = @compact ? "param.md-compact.erb" : "param.md.erb"
|
163
|
+
dumped << ERB.new(template_path(template_name).read, nil, "-").result(binding)
|
164
|
+
end
|
165
|
+
dumped << "\n"
|
166
|
+
sections.each do |section_name, sub_section|
|
167
|
+
required = sub_section.delete(:required)
|
168
|
+
multi = sub_section.delete(:multi)
|
169
|
+
alias_name = sub_section.delete(:alias)
|
170
|
+
$log.trace(name: section_name, required: required, multi: multi, alias_name: alias_name)
|
171
|
+
sub_section.delete(:section)
|
172
|
+
dumped << ERB.new(template_path("section.md.erb").read, nil, "-").result(binding)
|
173
|
+
end
|
174
|
+
dumped
|
175
|
+
end
|
176
|
+
|
177
|
+
def dump_json(dumped_config)
|
178
|
+
if @compact
|
179
|
+
JSON.generate(dumped_config)
|
180
|
+
else
|
181
|
+
JSON.pretty_generate(dumped_config)
|
182
|
+
end
|
183
|
+
end
|
184
|
+
|
185
|
+
def usage(message = nil)
|
186
|
+
puts @parser.to_s
|
187
|
+
puts
|
188
|
+
puts "Error: #{message}" if message
|
189
|
+
exit(false)
|
190
|
+
end
|
191
|
+
|
192
|
+
def prepare_option_parser
|
193
|
+
@parser = OptionParser.new
|
194
|
+
@parser.banner = <<BANNER
|
195
|
+
Usage: #{$0} [options] <type> <name>
|
196
|
+
|
197
|
+
Output plugin config definitions
|
198
|
+
|
199
|
+
Arguments:
|
200
|
+
\ttype: #{SUPPORTED_TYPES.join(",")}
|
201
|
+
\tname: registered plugin name
|
202
|
+
|
203
|
+
Options:
|
204
|
+
BANNER
|
205
|
+
@parser.on("--verbose", "Be verbose") do
|
206
|
+
@verbose = true
|
207
|
+
end
|
208
|
+
@parser.on("-c", "--compact", "Compact output") do
|
209
|
+
@compact = true
|
210
|
+
end
|
211
|
+
@parser.on("-f", "--format=FORMAT", "Specify format. (#{AVAILABLE_FORMATS.join(',')})") do |s|
|
212
|
+
format = s.to_sym
|
213
|
+
usage("Unsupported format: #{s}") unless AVAILABLE_FORMATS.include?(format)
|
214
|
+
@format = format
|
215
|
+
end
|
216
|
+
@parser.on("-I PATH", "Add PATH to $LOAD_PATH") do |s|
|
217
|
+
$LOAD_PATH.unshift(s)
|
218
|
+
end
|
219
|
+
@parser.on("-r NAME", "Load library") do |s|
|
220
|
+
@libs << s
|
221
|
+
end
|
222
|
+
@parser.on("-p", "--plugin=DIR", "Add plugin directory") do |s|
|
223
|
+
@plugin_dirs << s
|
224
|
+
end
|
225
|
+
end
|
226
|
+
|
227
|
+
def parse_options!
|
228
|
+
@parser.parse!(@argv)
|
229
|
+
|
230
|
+
raise "Must specify plugin type and name" unless @argv.size == 2
|
231
|
+
|
232
|
+
@plugin_type, @plugin_name = @argv
|
233
|
+
@options = {
|
234
|
+
compact: @compact,
|
235
|
+
format: @format,
|
236
|
+
verbose: @verbose,
|
237
|
+
}
|
238
|
+
rescue => e
|
239
|
+
usage(e)
|
240
|
+
end
|
241
|
+
|
242
|
+
def init_libraries
|
243
|
+
@libs.each do |lib|
|
244
|
+
require lib
|
245
|
+
end
|
246
|
+
|
247
|
+
@plugin_dirs.each do |dir|
|
248
|
+
if Dir.exist?(dir)
|
249
|
+
dir = File.expand_path(dir)
|
250
|
+
Fluent::Plugin.add_plugin_dir(dir)
|
251
|
+
end
|
252
|
+
end
|
253
|
+
end
|
254
|
+
|
255
|
+
def template_path(name)
|
256
|
+
(Pathname(__dir__) + "../../../templates/plugin_config_formatter/#{name}").realpath
|
257
|
+
end
|
258
|
+
end
|