├── .deepsource.toml ├── .github ├── DISCUSSION_TEMPLATE │ ├── q-a-japanese.yml │ └── q-a.yml ├── ISSUE_TEMPLATE.md ├── ISSUE_TEMPLATE │ ├── bug_report.yml │ ├── config.yml │ └── feature_request.yml ├── PULL_REQUEST_TEMPLATE.md ├── dependabot.yml └── workflows │ ├── benchmark.yml │ ├── scorecards.yml │ ├── stale-actions.yml │ ├── test-ruby-head.yml │ └── test.yml ├── .gitignore ├── ADOPTERS.md ├── AUTHORS ├── CHANGELOG.md ├── CONTRIBUTING.md ├── GOVERNANCE.md ├── Gemfile ├── GithubWorkflow.md ├── LICENSE ├── MAINTAINERS.md ├── README.md ├── Rakefile ├── SECURITY.md ├── bin ├── fluent-binlog-reader ├── fluent-ca-generate ├── fluent-cap-ctl ├── fluent-cat ├── fluent-ctl ├── fluent-debug ├── fluent-gem ├── fluent-plugin-config-format ├── fluent-plugin-generate └── fluentd ├── code-of-conduct.md ├── docs └── SECURITY_AUDIT.pdf ├── example ├── copy_roundrobin.conf ├── counter.conf ├── filter_stdout.conf ├── in_forward.conf ├── in_forward_client.conf ├── in_forward_shared_key.conf ├── in_forward_tls.conf ├── in_forward_users.conf ├── in_forward_workers.conf ├── in_http.conf ├── in_out_forward.conf ├── in_sample_blocks.conf ├── in_sample_with_compression.conf ├── in_syslog.conf ├── in_tail.conf ├── in_tcp.conf ├── in_udp.conf ├── logevents.conf ├── multi_filters.conf ├── out_copy.conf ├── out_exec_filter.conf ├── out_file.conf ├── out_forward.conf ├── out_forward_buf_file.conf ├── out_forward_client.conf ├── out_forward_heartbeat_none.conf ├── out_forward_sd.conf ├── out_forward_shared_key.conf ├── out_forward_tls.conf ├── out_forward_users.conf ├── out_null.conf ├── sd.yaml ├── secondary_file.conf ├── suppress_config_dump.conf ├── v0_12_filter.conf ├── v1_literal_example.conf └── worker_section.conf ├── fluent.conf ├── fluentd.gemspec ├── lib └── fluent │ ├── agent.rb │ ├── capability.rb │ ├── clock.rb │ ├── command │ ├── binlog_reader.rb │ ├── bundler_injection.rb │ ├── ca_generate.rb │ ├── cap_ctl.rb │ ├── cat.rb │ ├── ctl.rb │ ├── debug.rb │ ├── fluentd.rb │ ├── plugin_config_formatter.rb │ └── plugin_generator.rb │ ├── compat │ ├── call_super_mixin.rb │ ├── detach_process_mixin.rb │ ├── exec_util.rb │ ├── file_util.rb │ ├── filter.rb │ ├── formatter.rb │ ├── formatter_utils.rb │ ├── handle_tag_and_time_mixin.rb │ ├── handle_tag_name_mixin.rb │ ├── input.rb │ ├── output.rb │ ├── output_chain.rb │ ├── parser.rb │ ├── parser_utils.rb │ ├── propagate_default.rb │ ├── record_filter_mixin.rb │ ├── set_tag_key_mixin.rb │ ├── set_time_key_mixin.rb │ ├── socket_util.rb │ ├── string_util.rb │ ├── structured_format_mixin.rb │ └── type_converter.rb │ ├── config.rb │ ├── config │ ├── basic_parser.rb │ ├── configure_proxy.rb │ ├── dsl.rb │ ├── element.rb │ ├── error.rb │ ├── literal_parser.rb │ ├── parser.rb │ ├── section.rb │ ├── types.rb │ ├── v1_parser.rb │ ├── yaml_parser.rb │ └── yaml_parser │ │ ├── fluent_value.rb │ │ ├── loader.rb │ │ ├── parser.rb │ │ └── section_builder.rb │ ├── configurable.rb │ ├── counter.rb │ ├── counter │ ├── base_socket.rb │ ├── client.rb │ ├── error.rb │ ├── mutex_hash.rb │ ├── server.rb │ ├── store.rb │ └── validator.rb │ ├── daemon.rb │ ├── daemonizer.rb │ ├── engine.rb │ ├── env.rb │ ├── error.rb │ ├── event.rb │ ├── event_router.rb │ ├── ext_monitor_require.rb │ ├── file_wrapper.rb │ ├── filter.rb │ ├── fluent_log_event_router.rb │ ├── formatter.rb │ ├── input.rb │ ├── label.rb │ ├── load.rb │ ├── log.rb │ ├── log │ └── console_adapter.rb │ ├── match.rb │ ├── mixin.rb │ ├── msgpack_factory.rb │ ├── oj_options.rb │ ├── output.rb │ ├── output_chain.rb │ ├── parser.rb │ ├── plugin.rb │ ├── plugin │ ├── bare_output.rb │ ├── base.rb │ ├── buf_file.rb │ ├── buf_file_single.rb │ ├── buf_memory.rb │ ├── buffer.rb │ ├── buffer │ │ ├── chunk.rb │ │ ├── file_chunk.rb │ │ ├── file_single_chunk.rb │ │ └── memory_chunk.rb │ ├── compressable.rb │ ├── exec_util.rb │ ├── file_util.rb │ ├── filter.rb │ ├── filter_grep.rb │ ├── filter_parser.rb │ ├── filter_record_transformer.rb │ ├── filter_stdout.rb │ ├── formatter.rb │ ├── formatter_csv.rb │ ├── formatter_hash.rb │ ├── formatter_json.rb │ ├── formatter_ltsv.rb │ ├── formatter_msgpack.rb │ ├── formatter_out_file.rb │ ├── formatter_single_value.rb │ ├── formatter_stdout.rb │ ├── formatter_tsv.rb │ ├── in_debug_agent.rb │ ├── in_dummy.rb │ ├── in_exec.rb │ ├── in_forward.rb │ ├── in_gc_stat.rb │ ├── in_http.rb │ ├── in_monitor_agent.rb │ ├── in_object_space.rb │ ├── in_sample.rb │ ├── in_syslog.rb │ ├── in_tail.rb │ ├── in_tail │ │ ├── group_watch.rb │ │ └── position_file.rb │ ├── in_tcp.rb │ ├── in_udp.rb │ ├── in_unix.rb │ ├── input.rb │ ├── metrics.rb │ ├── metrics_local.rb │ ├── multi_output.rb │ ├── out_buffer.rb │ ├── out_copy.rb │ ├── out_exec.rb │ ├── out_exec_filter.rb │ ├── out_file.rb │ ├── out_forward.rb │ ├── out_forward │ │ ├── ack_handler.rb │ │ ├── connection_manager.rb │ │ ├── error.rb │ │ ├── failure_detector.rb │ │ ├── handshake_protocol.rb │ │ ├── load_balancer.rb │ │ └── socket_cache.rb │ ├── out_http.rb │ ├── out_null.rb │ ├── out_relabel.rb │ ├── out_roundrobin.rb │ ├── out_secondary_file.rb │ ├── out_stdout.rb │ ├── out_stream.rb │ ├── output.rb │ ├── owned_by_mixin.rb │ ├── parser.rb │ ├── parser_apache.rb │ ├── parser_apache2.rb │ ├── parser_apache_error.rb │ ├── parser_csv.rb │ ├── parser_json.rb │ ├── parser_ltsv.rb │ ├── parser_msgpack.rb │ ├── parser_multiline.rb │ ├── parser_nginx.rb │ ├── parser_none.rb │ ├── parser_regexp.rb │ ├── parser_syslog.rb │ ├── parser_tsv.rb │ ├── sd_file.rb │ ├── sd_srv.rb │ ├── sd_static.rb │ ├── service_discovery.rb │ ├── socket_util.rb │ ├── storage.rb │ ├── storage_local.rb │ └── string_util.rb │ ├── plugin_helper.rb │ ├── plugin_helper │ ├── cert_option.rb │ ├── child_process.rb │ ├── compat_parameters.rb │ ├── counter.rb │ ├── event_emitter.rb │ ├── event_loop.rb │ ├── extract.rb │ ├── formatter.rb │ ├── http_server.rb │ ├── http_server │ │ ├── app.rb │ │ ├── methods.rb │ │ ├── request.rb │ │ ├── router.rb │ │ ├── server.rb │ │ └── ssl_context_builder.rb │ ├── inject.rb │ ├── metrics.rb │ ├── parser.rb │ ├── record_accessor.rb │ ├── retry_state.rb │ ├── server.rb │ ├── service_discovery.rb │ ├── service_discovery │ │ ├── manager.rb │ │ └── round_robin_balancer.rb │ ├── socket.rb │ ├── socket_option.rb │ ├── storage.rb │ ├── thread.rb │ └── timer.rb │ ├── plugin_id.rb │ ├── process.rb │ ├── registry.rb │ ├── root_agent.rb │ ├── rpc.rb │ ├── source_only_buffer_agent.rb │ ├── static_config_analysis.rb │ ├── supervisor.rb │ ├── system_config.rb │ ├── test.rb │ ├── test │ ├── base.rb │ ├── driver │ │ ├── base.rb │ │ ├── base_owned.rb │ │ ├── base_owner.rb │ │ ├── event_feeder.rb │ │ ├── filter.rb │ │ ├── formatter.rb │ │ ├── input.rb │ │ ├── multi_output.rb │ │ ├── output.rb │ │ ├── parser.rb │ │ ├── storage.rb │ │ └── test_event_router.rb │ ├── filter_test.rb │ ├── formatter_test.rb │ ├── helpers.rb │ ├── input_test.rb │ ├── log.rb │ ├── output_test.rb │ ├── parser_test.rb │ └── startup_shutdown.rb │ ├── time.rb │ ├── timezone.rb │ ├── tls.rb │ ├── unique_id.rb │ ├── variable_store.rb │ ├── version.rb │ ├── win32api.rb │ └── winsvc.rb ├── tasks ├── benchmark.rb └── benchmark │ ├── conf │ └── in_tail.conf │ └── patch_in_tail.rb ├── templates ├── new_gem │ ├── Gemfile │ ├── README.md.erb │ ├── Rakefile │ ├── fluent-plugin.gemspec.erb │ ├── lib │ │ └── fluent │ │ │ └── plugin │ │ │ ├── filter.rb.erb │ │ │ ├── formatter.rb.erb │ │ │ ├── input.rb.erb │ │ │ ├── output.rb.erb │ │ │ ├── parser.rb.erb │ │ │ └── storage.rb.erb │ └── test │ │ ├── helper.rb.erb │ │ └── plugin │ │ ├── test_filter.rb.erb │ │ ├── test_formatter.rb.erb │ │ ├── test_input.rb.erb │ │ ├── test_output.rb.erb │ │ ├── test_parser.rb.erb │ │ └── test_storage.rb.erb └── plugin_config_formatter │ ├── param.md-compact.erb │ ├── param.md-table.erb │ ├── param.md.erb │ └── section.md.erb └── test ├── command ├── test_binlog_reader.rb ├── test_ca_generate.rb ├── test_cap_ctl.rb ├── test_cat.rb ├── test_ctl.rb ├── test_fluentd.rb ├── test_plugin_config_formatter.rb └── test_plugin_generator.rb ├── compat ├── test_calls_super.rb └── test_parser.rb ├── config ├── assertions.rb ├── test_config_parser.rb ├── test_configurable.rb ├── test_configure_proxy.rb ├── test_dsl.rb ├── test_element.rb ├── test_literal_parser.rb ├── test_plugin_configuration.rb ├── test_section.rb ├── test_system_config.rb └── test_types.rb ├── counter ├── test_client.rb ├── test_error.rb ├── test_mutex_hash.rb ├── test_server.rb ├── test_store.rb └── test_validator.rb ├── helper.rb ├── helpers ├── fuzzy_assert.rb └── process_extenstion.rb ├── log └── test_console_adapter.rb ├── plugin ├── data │ ├── 2010 │ │ └── 01 │ │ │ ├── 20100102-030405.log │ │ │ ├── 20100102-030406.log │ │ │ └── 20100102.log │ ├── log │ │ ├── bar │ │ ├── foo │ │ │ ├── bar.log │ │ │ └── bar2 │ │ └── test.log │ ├── log_numeric │ │ ├── 01.log │ │ ├── 02.log │ │ ├── 12.log │ │ └── 14.log │ └── sd_file │ │ ├── config │ │ ├── config.json │ │ ├── config.yaml │ │ ├── config.yml │ │ └── invalid_config.yml ├── in_tail │ ├── test_fifo.rb │ ├── test_io_handler.rb │ └── test_position_file.rb ├── out_forward │ ├── test_ack_handler.rb │ ├── test_connection_manager.rb │ ├── test_handshake_protocol.rb │ ├── test_load_balancer.rb │ └── test_socket_cache.rb ├── test_bare_output.rb ├── test_base.rb ├── test_buf_file.rb ├── test_buf_file_single.rb ├── test_buf_memory.rb ├── test_buffer.rb ├── test_buffer_chunk.rb ├── test_buffer_file_chunk.rb ├── test_buffer_file_single_chunk.rb ├── test_buffer_memory_chunk.rb ├── test_compressable.rb ├── test_file_util.rb ├── test_filter.rb ├── test_filter_grep.rb ├── test_filter_parser.rb ├── test_filter_record_transformer.rb ├── test_filter_stdout.rb ├── test_formatter_csv.rb ├── test_formatter_hash.rb ├── test_formatter_json.rb ├── test_formatter_ltsv.rb ├── test_formatter_msgpack.rb ├── test_formatter_out_file.rb ├── test_formatter_single_value.rb ├── test_formatter_tsv.rb ├── test_in_debug_agent.rb ├── test_in_exec.rb ├── test_in_forward.rb ├── test_in_gc_stat.rb ├── test_in_http.rb ├── test_in_monitor_agent.rb ├── test_in_object_space.rb ├── test_in_sample.rb ├── test_in_syslog.rb ├── test_in_tail.rb ├── test_in_tcp.rb ├── test_in_udp.rb ├── test_in_unix.rb ├── test_input.rb ├── test_metadata.rb ├── test_metrics.rb ├── test_metrics_local.rb ├── test_multi_output.rb ├── test_out_buffer.rb ├── test_out_copy.rb ├── test_out_exec.rb ├── test_out_exec_filter.rb ├── test_out_file.rb ├── test_out_forward.rb ├── test_out_http.rb ├── test_out_null.rb ├── test_out_relabel.rb ├── test_out_roundrobin.rb ├── test_out_secondary_file.rb ├── test_out_stdout.rb ├── test_out_stream.rb ├── test_output.rb ├── test_output_as_buffered.rb ├── test_output_as_buffered_backup.rb ├── test_output_as_buffered_compress.rb ├── test_output_as_buffered_overflow.rb ├── test_output_as_buffered_retries.rb ├── test_output_as_buffered_secondary.rb ├── test_output_as_standard.rb ├── test_owned_by.rb ├── test_parser.rb ├── test_parser_apache.rb ├── test_parser_apache2.rb ├── test_parser_apache_error.rb ├── test_parser_csv.rb ├── test_parser_json.rb ├── test_parser_labeled_tsv.rb ├── test_parser_msgpack.rb ├── test_parser_multiline.rb ├── test_parser_nginx.rb ├── test_parser_none.rb ├── test_parser_regexp.rb ├── test_parser_syslog.rb ├── test_parser_tsv.rb ├── test_sd_file.rb ├── test_sd_srv.rb ├── test_storage.rb ├── test_storage_local.rb └── test_string_util.rb ├── plugin_helper ├── data │ └── cert │ │ ├── cert-key.pem │ │ ├── cert-with-CRLF.pem │ │ ├── cert-with-no-newline.pem │ │ ├── cert.pem │ │ ├── cert_chains │ │ ├── ca-cert-key.pem │ │ ├── ca-cert.pem │ │ ├── cert-key.pem │ │ └── cert.pem │ │ ├── empty.pem │ │ ├── generate_cert.rb │ │ ├── with_ca │ │ ├── ca-cert-key-pass.pem │ │ ├── ca-cert-key.pem │ │ ├── ca-cert-pass.pem │ │ ├── ca-cert.pem │ │ ├── cert-key-pass.pem │ │ ├── cert-key.pem │ │ ├── cert-pass.pem │ │ └── cert.pem │ │ └── without_ca │ │ ├── cert-key-pass.pem │ │ ├── cert-key.pem │ │ ├── cert-pass.pem │ │ └── cert.pem ├── http_server │ ├── test_app.rb │ ├── test_request.rb │ └── test_route.rb ├── service_discovery │ ├── test_manager.rb │ └── test_round_robin_balancer.rb ├── test_cert_option.rb ├── test_child_process.rb ├── test_compat_parameters.rb ├── test_event_emitter.rb ├── test_event_loop.rb ├── test_extract.rb ├── test_formatter.rb ├── test_http_server_helper.rb ├── test_inject.rb ├── test_metrics.rb ├── test_parser.rb ├── test_record_accessor.rb ├── test_retry_state.rb ├── test_server.rb ├── test_service_discovery.rb ├── test_socket.rb ├── test_storage.rb ├── test_thread.rb └── test_timer.rb ├── scripts ├── exec_script.rb ├── fluent │ └── plugin │ │ ├── formatter1 │ │ └── formatter_test1.rb │ │ ├── formatter2 │ │ └── formatter_test2.rb │ │ ├── formatter_known.rb │ │ ├── out_test.rb │ │ ├── out_test2.rb │ │ └── parser_known.rb └── windows_service_test.ps1 ├── test_capability.rb ├── test_clock.rb ├── test_config.rb ├── test_configdsl.rb ├── test_daemonizer.rb ├── test_engine.rb ├── test_event.rb ├── test_event_router.rb ├── test_event_time.rb ├── test_file_wrapper.rb ├── test_filter.rb ├── test_fluent_log_event_router.rb ├── test_formatter.rb ├── test_input.rb ├── test_log.rb ├── test_match.rb ├── test_mixin.rb ├── test_msgpack_factory.rb ├── test_oj_options.rb ├── test_output.rb ├── test_plugin.rb ├── test_plugin_classes.rb ├── test_plugin_helper.rb ├── test_plugin_id.rb ├── test_process.rb ├── test_root_agent.rb ├── test_source_only_buffer_agent.rb ├── test_static_config_analysis.rb ├── test_supervisor.rb ├── test_test_drivers.rb ├── test_time_formatter.rb ├── test_time_parser.rb ├── test_tls.rb ├── test_unique_id.rb └── test_variable_store.rb /.deepsource.toml: -------------------------------------------------------------------------------- 1 | version = 1 2 | 3 | test_patterns = ["test/**/test_*.rb"] 4 | 5 | exclude_patterns = [ 6 | "bin/**", 7 | "docs/**", 8 | "example/**" 9 | ] 10 | 11 | [[analyzers]] 12 | name = "ruby" 13 | enabled = true 14 | -------------------------------------------------------------------------------- /.github/DISCUSSION_TEMPLATE/q-a-japanese.yml: -------------------------------------------------------------------------------- 1 | title: "[QA (Japanese)]" 2 | labels: ["Q&A (Japanese)"] 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | 日本語で気軽に質問するためのカテゴリです。もし他の人が困っているのを見つけたらぜひ回答してあげてください。 8 | - type: textarea 9 | id: question 10 | attributes: 11 | label: やりたいこと 12 | description: | 13 | 何について困っているのかを書いてください。試したことや実際の結果を示してください。 14 | 期待する挙動と実際の結果の違いがあればそれも書くのをおすすめします。 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: configuration 19 | attributes: 20 | label: 設定した内容 21 | description: | 22 | どのような設定をして期待する挙動を実現しようとしたのかを書いてください。(例: fluentd.confの内容を貼り付ける) 23 | render: apache 24 | - type: textarea 25 | id: logs 26 | attributes: 27 | label: ログの内容 28 | description: | 29 | Fluentdのログを提示してください。エラーログがあると回答の助けになります。(例: fluentd.logの内容を貼り付ける) 30 | render: shell 31 | - type: textarea 32 | id: environment 33 | attributes: 34 | label: 環境について 35 | description: | 36 | - Fluentd or td-agent version: `fluentd --version` or `td-agent --version` 37 | - Operating system: `cat /etc/os-release` 38 | - Kernel version: `uname -r` 39 | 40 | どんな環境で困っているかの情報がないと、再現できないため誰も回答できないことがあります。 41 | 必要な情報を記入することをおすすめします。 42 | value: | 43 | - Fluentd version: 44 | - TD Agent version: 45 | - Fluent Package version: 46 | - Docker image (tag): 47 | - Operating system: 48 | - Kernel version: 49 | render: markdown 50 | -------------------------------------------------------------------------------- /.github/DISCUSSION_TEMPLATE/q-a.yml: -------------------------------------------------------------------------------- 1 | title: "[Q&A]" 2 | labels: ["Q&A"] 3 | body: 4 | - type: markdown 5 | attributes: 6 | value: | 7 | It is recommended to support each other. 8 | - type: textarea 9 | id: question 10 | attributes: 11 | label: What is a problem? 12 | description: | 13 | A clear and concise description of what you want to happen. 14 | What exactly did you do (or not do) that was effective (or ineffective)? 15 | validations: 16 | required: true 17 | - type: textarea 18 | id: configuration 19 | attributes: 20 | label: Describe the configuration of Fluentd 21 | description: | 22 | If there is the actual configuration of Fluentd, it will help. 23 | - type: textarea 24 | id: logs 25 | attributes: 26 | label: Describe the logs of Fluentd 27 | description: | 28 | If there are error logs of Fluentd, it will help. 29 | - type: textarea 30 | id: environment 31 | attributes: 32 | label: Environment 33 | description: | 34 | - Fluentd or td-agent version: `fluentd --version` or `td-agent --version` 35 | - Operating system: `cat /etc/os-release` 36 | - Kernel version: `uname -r` 37 | 38 | Please describe your environment information. If will help to support. 39 | value: | 40 | - Fluentd version: 41 | - TD Agent version: 42 | - Fluent Package version: 43 | - Docker image (tag): 44 | - Operating system: 45 | - Kernel version: 46 | render: markdown 47 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CONTRIBUTING.md) first and here is the list to help us investigate the problem. 2 | 3 | **Got a question or problem?** 4 | 5 | RESOURCES of [Official site](https://www.fluentd.org/) and [Fluentd documentation](https://docs.fluentd.org/) may help you. 6 | 7 | If you have further questions about Fluentd and plugins, please direct these to [Mailing List](https://groups.google.com/forum/#!forum/fluentd). 8 | Don't use Github issue for asking questions. Here are examples: 9 | 10 | - I installed xxx plugin but it doesn't work. Why? 11 | - Fluentd starts but logs are not sent to xxx. Am I wrong? 12 | - I want to do xxx. How to realize it with plugins? 13 | 14 | We may close such questions to keep clear repository for developers and users. 15 | Github issue is mainly for submitting a bug report or feature request. See below. 16 | 17 | If you can't judge your case is a bug or not, use mailing list or slack first. 18 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/config.yml: -------------------------------------------------------------------------------- 1 | blank_issues_enabled: false 2 | contact_links: 3 | - name: Ask a Question 4 | url: https://github.com/fluent/fluentd/discussions 5 | about: I have questions about Fluentd and plugins. Please ask and answer questions at https://github.com/fluent/fluentd/discussions 6 | - name: Feedback a Fluentd Use-Case/Testimonial 7 | url: https://github.com/fluent/fluentd-website/issues/new?template=testimonials.yml 8 | about: Feedback your Fluentd use-case/testimonial, How do you use Fluentd in your service? 9 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature_request.yml: -------------------------------------------------------------------------------- 1 | name: Feature request 2 | description: Suggest an idea for this project 3 | labels: "waiting-for-triage" 4 | body: 5 | - type: markdown 6 | attributes: 7 | value: | 8 | Check [CONTRIBUTING guideline](https://github.com/fluent/fluentd/blob/master/CONTRIBUTING.md) first and here is the list to help us investigate the problem. 9 | - type: textarea 10 | id: description 11 | attributes: 12 | label: Is your feature request related to a problem? Please describe. 13 | description: | 14 | A clear and concise description of what the problem is. 15 | Ex. I'm always frustrated when [...] 16 | validations: 17 | required: true 18 | - type: textarea 19 | id: solution 20 | attributes: 21 | label: Describe the solution you'd like 22 | description: A clear and concise description of what you want to happen. 23 | validations: 24 | required: true 25 | - type: textarea 26 | id: alternative 27 | attributes: 28 | label: Describe alternatives you've considered 29 | description: A clear and concise description of any alternative solutions or features you've considered. 30 | validations: 31 | required: true 32 | - type: textarea 33 | id: addtional-context 34 | attributes: 35 | label: Additional context 36 | description: Add any other context or screenshots about the feature request here. 37 | validations: 38 | required: false 39 | 40 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 6 | 7 | **Which issue(s) this PR fixes**: 8 | Fixes # 9 | 10 | **What this PR does / why we need it**: 11 | 12 | **Docs Changes**: 13 | 14 | **Release Note**: 15 | -------------------------------------------------------------------------------- /.github/dependabot.yml: -------------------------------------------------------------------------------- 1 | version: 2 2 | updates: 3 | - package-ecosystem: 'github-actions' 4 | directory: '/' 5 | schedule: 6 | interval: 'weekly' 7 | -------------------------------------------------------------------------------- /.github/workflows/benchmark.yml: -------------------------------------------------------------------------------- 1 | name: Benchmark 2 | 3 | on: 4 | push: 5 | branches: [master] 6 | pull_request: 7 | branches: [master] 8 | workflow_dispatch: 9 | 10 | permissions: read-all 11 | 12 | concurrency: 13 | group: ${{ github.head_ref || github.sha }}-${{ github.workflow }} 14 | cancel-in-progress: true 15 | 16 | jobs: 17 | test: 18 | runs-on: ${{ matrix.os }} 19 | continue-on-error: false 20 | strategy: 21 | fail-fast: false 22 | matrix: 23 | os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] 24 | ruby-version: ['3.4'] 25 | 26 | name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }} 27 | steps: 28 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 29 | - name: Set up Ruby 30 | uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 31 | with: 32 | ruby-version: ${{ matrix.ruby-version }} 33 | - name: Install dependencies 34 | run: bundle install 35 | - name: Run Benchmark 36 | shell: bash # Ensure to use bash shell on all platforms 37 | run: | 38 | bundle exec rake benchmark:run:in_tail | tee -a $GITHUB_STEP_SUMMARY 39 | -------------------------------------------------------------------------------- /.github/workflows/stale-actions.yml: -------------------------------------------------------------------------------- 1 | name: "Mark or close stale issues and PRs" 2 | on: 3 | schedule: 4 | - cron: "00 10 * * *" 5 | 6 | permissions: read-all 7 | 8 | jobs: 9 | stale: 10 | runs-on: ubuntu-latest 11 | permissions: 12 | issues: write 13 | pull-requests: write 14 | steps: 15 | - uses: actions/stale@5bef64f19d7facfb25b37b414482c7164d639639 # v9.1.0 16 | with: 17 | repo-token: ${{ secrets.GITHUB_TOKEN }} 18 | days-before-stale: 30 19 | days-before-close: 7 20 | stale-issue-message: "This issue has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this issue will be closed in 7 days" 21 | stale-pr-message: "This PR has been automatically marked as stale because it has been open 30 days with no activity. Remove stale label or comment or this PR will be closed in 7 days" 22 | close-issue-message: "This issue was automatically closed because of stale in 7 days" 23 | close-pr-message: "This PR was automatically closed because of stale in 7 days" 24 | stale-pr-label: "stale" 25 | stale-issue-label: "stale" 26 | exempt-issue-labels: "waiting-for-triage,bug,enhancement,feature request,pending,work-in-progress,v1,v2" 27 | exempt-pr-labels: "waiting-for-triage,bug,enhancement,feature request,pending,work-in-progress,v1,v2" 28 | exempt-all-assignees: true 29 | exempt-all-milestones: true 30 | -------------------------------------------------------------------------------- /.github/workflows/test-ruby-head.yml: -------------------------------------------------------------------------------- 1 | name: Test with Ruby head 2 | 3 | on: 4 | schedule: 5 | - cron: '11 14 * * 0' 6 | workflow_dispatch: 7 | 8 | permissions: read-all 9 | 10 | jobs: 11 | test: 12 | runs-on: ${{ matrix.os }} 13 | continue-on-error: false 14 | strategy: 15 | fail-fast: false 16 | matrix: 17 | os: ['ubuntu-latest', 'macos-latest', 'windows-latest'] 18 | ruby-version: ['head'] 19 | 20 | name: Ruby ${{ matrix.ruby-version }} on ${{ matrix.os }} 21 | steps: 22 | - uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 23 | - name: Set up Ruby 24 | uses: ruby/setup-ruby@13e7a03dc3ac6c3798f4570bfead2aed4d96abfb # v1.244.0 25 | with: 26 | ruby-version: ${{ matrix.ruby-version }} 27 | - name: Install addons 28 | if: ${{ matrix.os == 'ubuntu-latest' }} 29 | run: sudo apt-get install libgmp3-dev libcap-ng-dev 30 | - name: Install dependencies 31 | run: bundle install 32 | - name: Run tests 33 | run: bundle exec rake test TESTOPTS="-v --no-show-detail-immediately" 34 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | Gemfile.lock 2 | INSTALL 3 | NEWS 4 | Makefile 5 | Makefile.in 6 | README 7 | ac 8 | aclocal.m4 9 | autom4te.cache 10 | confdefs.h 11 | config.log 12 | config.status 13 | configure 14 | deps/ 15 | fluent-cat 16 | fluent-gem 17 | fluentd 18 | pkg/* 19 | tmp/* 20 | test/tmp/* 21 | test/config/tmp/* 22 | make_dist.sh 23 | Gemfile.local 24 | .ruby-version 25 | *.swp 26 | coverage/* 27 | .vagrant/ 28 | cov-int/ 29 | cov-fluentd.tar.gz 30 | .vscode 31 | .idea/ 32 | -------------------------------------------------------------------------------- /ADOPTERS.md: -------------------------------------------------------------------------------- 1 | # Fluentd Adopters 2 | 3 | Fluentd is widely used by hundred of companies, please refer to the testimonial section of our project website to learn more about it: 4 | 5 | https://www.fluentd.org/testimonials 6 | -------------------------------------------------------------------------------- /AUTHORS: -------------------------------------------------------------------------------- 1 | FURUHASHI Sadayuki 2 | NAKAGAWA Masahiro 3 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org/' 2 | 3 | gemspec 4 | 5 | gem 'benchmark' 6 | 7 | local_gemfile = File.join(File.dirname(__FILE__), "Gemfile.local") 8 | if File.exist?(local_gemfile) 9 | puts "Loading Gemfile.local ..." if $DEBUG # `ruby -d` or `bundle -v` 10 | instance_eval File.read(local_gemfile) 11 | end 12 | -------------------------------------------------------------------------------- /MAINTAINERS.md: -------------------------------------------------------------------------------- 1 | # Fluentd Maintainers 2 | 3 | - [Naotoshi Seo](https://github.com/sonots), [ZOZO Technologies](https://tech.zozo.com/en/) 4 | - [Okkez](https://github.com/okkez) 5 | - [Hiroshi Hatake](https://github.com/cosmo0920), [Calyptia](https://calyptia.com/) 6 | - [Masahiro Nakagawa](https://github.com/repeatedly) 7 | - [Satoshi Tagomori](https://github.com/tagomoris) 8 | - [Toru Takahashi](https://github.com/toru-takahashi), [Treasure Data](https://www.treasuredata.com/) 9 | - [Eduardo Silva](https://github.com/edsiper), [Calyptia](https://calyptia/) 10 | - [Fujimoto Seiji](https://github.com/fujimots) 11 | - [Takuro Ashie](https://github.com/ashie), [ClearCode](https://www.clear-code.com/) 12 | - [Kentaro Hayashi](https://github.com/kenhys), [ClearCode](https://www.clear-code.com/) 13 | - [Daijiro Fukuda](https://github.com/daipom), [ClearCode](https://www.clear-code.com/) 14 | -------------------------------------------------------------------------------- /SECURITY.md: -------------------------------------------------------------------------------- 1 | # Security Policy 2 | 3 | ## Supported Versions 4 | 5 | | Version | Supported | 6 | | ------- | ------------------ | 7 | | 1.18.x | :white_check_mark: | 8 | | 1.17.x | :x: | 9 | | 1.16.x | :white_check_mark: | 10 | | <= 1.15.x | :x: | 11 | 12 | ## Reporting a Vulnerability 13 | 14 | Please post your vulnerability report from the following page: 15 | https://github.com/fluent/fluentd/security/advisories 16 | -------------------------------------------------------------------------------- /bin/fluent-binlog-reader: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | here = File.dirname(__FILE__) 4 | $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib')) 5 | require 'fluent/command/binlog_reader' 6 | 7 | FluentBinlogReader.new.call 8 | -------------------------------------------------------------------------------- /bin/fluent-ca-generate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | $LOAD_PATH.unshift(File.join(__dir__, 'lib')) 4 | require 'fluent/command/ca_generate' 5 | 6 | Fluent::CaGenerate.new.call 7 | -------------------------------------------------------------------------------- /bin/fluent-cap-ctl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | here = File.dirname(__FILE__) 4 | $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib')) 5 | require 'fluent/command/cap_ctl' 6 | 7 | Fluent::CapCtl.new.call -------------------------------------------------------------------------------- /bin/fluent-cat: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | here = File.dirname(__FILE__) 4 | $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib')) 5 | require 'fluent/command/cat' 6 | -------------------------------------------------------------------------------- /bin/fluent-ctl: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | 3 | here = File.dirname(__FILE__) 4 | $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib')) 5 | require 'fluent/command/ctl' 6 | 7 | Fluent::Ctl.new.call 8 | -------------------------------------------------------------------------------- /bin/fluent-debug: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | here = File.dirname(__FILE__) 4 | $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib')) 5 | require 'fluent/command/debug' 6 | -------------------------------------------------------------------------------- /bin/fluent-gem: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | require 'rubygems/gem_runner' 4 | require 'rubygems/exceptions' 5 | begin 6 | Gem::GemRunner.new.run ARGV 7 | rescue Gem::SystemExitException => e 8 | exit e.exit_code 9 | end 10 | -------------------------------------------------------------------------------- /bin/fluent-plugin-config-format: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $LOAD_PATH.unshift(File.join(__dir__, 'lib')) 3 | require 'fluent/command/plugin_config_formatter' 4 | 5 | FluentPluginConfigFormatter.new.call 6 | -------------------------------------------------------------------------------- /bin/fluent-plugin-generate: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | $LOAD_PATH << File.expand_path(File.join(__dir__, '..', 'lib')) 3 | require 'fluent/command/plugin_generator' 4 | 5 | FluentPluginGenerator.new.call 6 | -------------------------------------------------------------------------------- /bin/fluentd: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | 4 | # In recent CRuby, RubyVM::InstructionSequence is always defined. 5 | # This optimization aims to reduce memory (avg 0.5 megabytes) at startup. 6 | # ref: http://atdot.net/~ko1/activities/2017_fukuoka_rubykaigi_02.pdf 7 | # But other implementation such as truffleruby does not provide such 8 | # class. 9 | if defined?(RubyVM::InstructionSequence) 10 | RubyVM::InstructionSequence.compile_option = {trace_instruction: false} 11 | end 12 | 13 | here = File.dirname(__FILE__) 14 | $LOAD_PATH << File.expand_path(File.join(here, '..', 'lib')) 15 | require 'fluent/command/fluentd' 16 | -------------------------------------------------------------------------------- /code-of-conduct.md: -------------------------------------------------------------------------------- 1 | ## Fluentd Community Code of Conduct 2 | 3 | Fluentd follows the [CNCF Code of Conduct](https://github.com/cncf/foundation/blob/master/code-of-conduct.md). 4 | -------------------------------------------------------------------------------- /docs/SECURITY_AUDIT.pdf: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/fluent/fluentd/08ea1d8f7774ac022a3b982117db28a90400e32e/docs/SECURITY_AUDIT.pdf -------------------------------------------------------------------------------- /example/copy_roundrobin.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | @label @test 4 | tag test.copy 5 | auto_increment_key id 6 | 7 | 8 | 9 | @type sample 10 | @label @test 11 | tag test.rr 12 | auto_increment_key id 13 | 14 | 15 | 40 | -------------------------------------------------------------------------------- /example/counter.conf: -------------------------------------------------------------------------------- 1 | 2 | 3 | scope server1 4 | bind 127.0.0.1 5 | port 24321 6 | backup_path tmp/back 7 | 8 | 9 | 10 | 11 | @type sample 12 | tag "test.data" 13 | auto_increment_key number 14 | 15 | 16 | 17 | @type stdout 18 | 19 | -------------------------------------------------------------------------------- /example/filter_stdout.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag sample 4 | 5 | 6 | 7 | @type stdout 8 | 9 | 10 | 11 | @type stdout 12 | output_type hash 13 | 14 | 15 | 16 | @type stdout 17 | format ltsv 18 | 19 | 20 | 21 | @type null 22 | 23 | -------------------------------------------------------------------------------- /example/in_forward.conf: -------------------------------------------------------------------------------- 1 | 2 | rpc_endpoint 0.0.0.0:24444 3 | 4 | 5 | 6 | @type forward 7 | 8 | 9 | 10 | @type stdout 11 | # 12 | # flush_interval 10s 13 | # 14 | 15 | -------------------------------------------------------------------------------- /example/in_forward_client.conf: -------------------------------------------------------------------------------- 1 | 2 | rpc_endpoint 0.0.0.0:24444 3 | 4 | 5 | 6 | @type forward 7 | port 24224 8 | bind 0.0.0.0 9 | 10 | self_hostname input.testing.local 11 | shared_key secure_communication_is_awesome 12 | user_auth yes 13 | allow_anonymous_source no 14 | 15 | username user1 16 | password yes_this_is_user1 17 | 18 | 19 | username user2 20 | password yes_this_is_really_user2 21 | 22 | 23 | username user3 24 | password noooooo_this_may_not_be_user3 25 | 26 | 27 | # host 127.0.0.1 28 | network 127.0.0.0/24 29 | shared_key using_different_key_makes_us_secure 30 | users user1,user2 31 | 32 | 33 | 34 | 35 | 36 | @type stdout 37 | 38 | -------------------------------------------------------------------------------- /example/in_forward_shared_key.conf: -------------------------------------------------------------------------------- 1 | 2 | rpc_endpoint 0.0.0.0:24444 3 | 4 | 5 | 6 | @type forward 7 | 8 | self_hostname input.testing.local 9 | shared_key secure_communication_is_awesome 10 | 11 | 12 | 13 | 14 | @type stdout 15 | 16 | -------------------------------------------------------------------------------- /example/in_forward_tls.conf: -------------------------------------------------------------------------------- 1 | 2 | @type forward 3 | port 24224 4 | 5 | insecure true 6 | 7 | 8 | 9 | 10 | @type stdout 11 | # 12 | # flush_interval 10s 13 | # 14 | 15 | -------------------------------------------------------------------------------- /example/in_forward_users.conf: -------------------------------------------------------------------------------- 1 | 2 | rpc_endpoint 0.0.0.0:24444 3 | 4 | 5 | 6 | @type forward 7 | 8 | self_hostname input.testing.local 9 | shared_key secure_communication_is_awesome 10 | user_auth yes 11 | 12 | username user1 13 | password yes_this_is_user1 14 | 15 | 16 | username user2 17 | password yes_this_is_really_user2 18 | 19 | 20 | 21 | 22 | 23 | @type stdout 24 | 25 | -------------------------------------------------------------------------------- /example/in_forward_workers.conf: -------------------------------------------------------------------------------- 1 | 2 | workers 3 3 | root_dir "#{File.join(Dir.pwd, 'test', 'tmp', 'root')}" 4 | 5 | 6 | 7 | @type forward 8 | @id forward_in_1 9 | 10 | 11 | 12 | @type stdout 13 | @id stdout_out_1 14 | 15 | worker_id_key worker_id 16 | 17 | 18 | @type file 19 | flush_interval 1s 20 | 21 | 22 | -------------------------------------------------------------------------------- /example/in_http.conf: -------------------------------------------------------------------------------- 1 | 2 | @type http 3 | bind 0.0.0.0 4 | port 9880 5 | body_size_limit 32MB 6 | keepalive_timeout 10 7 | # backlog 0 8 | add_http_headers false 9 | 10 | @type json 11 | 12 | 13 | 14 | 15 | @type stdout 16 | 17 | -------------------------------------------------------------------------------- /example/in_out_forward.conf: -------------------------------------------------------------------------------- 1 | 2 | @type forward 3 | port 24224 4 | 5 | 6 | 7 | @type forward 8 | buffer_type file 9 | buffer_path /tmp/fluentd.forward.buffer 10 | num_threads 10 11 | flush_interval 1s 12 | 13 | host 127.0.0.1 14 | port 24225 15 | 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/in_sample_blocks.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag sample 4 | rate 100 5 | sample {"message":"yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay"} 6 | 7 | 8 | 9 | @type null 10 | never_flush true 11 | 12 | @type memory 13 | overflow_action block 14 | chunk_limit_size 1k 15 | total_limit_size 2k 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/in_sample_with_compression.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | @label @main 4 | tag "test.data" 5 | size 2 6 | rate 10 7 | sample {"message":"yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaay"} 8 | auto_increment_key number 9 | 10 | 11 | 24 | -------------------------------------------------------------------------------- /example/in_syslog.conf: -------------------------------------------------------------------------------- 1 | 2 | @type syslog 3 | bind 0.0.0.0 4 | port 5140 5 | tag test 6 | protocol_type udp 7 | include_source_host false 8 | source_host_key source_host 9 | # format ... 10 | # with_priority true 11 | 12 | 13 | 14 | @type stdout 15 | 16 | -------------------------------------------------------------------------------- /example/in_tail.conf: -------------------------------------------------------------------------------- 1 | 2 | @type tail 3 | format none 4 | path /var/log/fluentd_test.log 5 | pos_file /var/log/fluentd_test.pos 6 | tag test 7 | rotate_wait 5 8 | read_from_head true 9 | refresh_interval 60 10 | 11 | 12 | 13 | @type stdout 14 | 15 | -------------------------------------------------------------------------------- /example/in_tcp.conf: -------------------------------------------------------------------------------- 1 | 2 | @type tcp 3 | format none 4 | bind 0.0.0.0 5 | port 5170 6 | delimiter \n 7 | source_host_key "host" 8 | tag test 9 | 10 | 11 | 12 | @type stdout 13 | 14 | -------------------------------------------------------------------------------- /example/in_udp.conf: -------------------------------------------------------------------------------- 1 | 2 | @type udp 3 | format none 4 | bind 0.0.0.0 5 | port 5160 6 | body_size_limit 4KB 7 | source_host_key "host" 8 | tag test 9 | 10 | 11 | 12 | @type stdout 13 | 14 | -------------------------------------------------------------------------------- /example/logevents.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | @label @samplelog 4 | tag "data" 5 | sample {"message":"yay"} 6 | 7 | 12 | 26 | -------------------------------------------------------------------------------- /example/multi_filters.conf: -------------------------------------------------------------------------------- 1 | # This example is to measure optimized filter pipeline performance. 2 | 3 | 4 | @type sample 5 | tag test 6 | size 1000 7 | 8 | 9 | 10 | @type grep 11 | exclude1 hello . 12 | 13 | 14 | 15 | @type grep 16 | exclude1 hello . 17 | 18 | 19 | 20 | @type grep 21 | exclude1 hello . 22 | 23 | 24 | 25 | @type grep 26 | exclude1 hello . 27 | 28 | 29 | 30 | @type grep 31 | exclude1 hello . 32 | 33 | 34 | 35 | @type grep 36 | exclude1 hello . 37 | 38 | 39 | 40 | @type grep 41 | exclude1 hello . 42 | 43 | 44 | 45 | @type grep 46 | exclude1 hello . 47 | 48 | 49 | 50 | @type grep 51 | exclude1 hello . 52 | 53 | 54 | 55 | @type grep 56 | exclude1 hello . 57 | 58 | 59 | 60 | @type buffered_null 61 | 62 | -------------------------------------------------------------------------------- /example/out_copy.conf: -------------------------------------------------------------------------------- 1 | 2 | @type forward 3 | 4 | 5 | 6 | @type copy 7 | deep_copy false 8 | 9 | @type stdout 10 | 11 | 12 | @type file 13 | path /var/log/fluentd/out_file_test 14 | format json 15 | buffer_type memory 16 | # compress gzip 17 | # symlink_path /path/to/symlink 18 | append false 19 | 20 | 21 | -------------------------------------------------------------------------------- /example/out_exec_filter.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | @label @exec 4 | tag exec_input 5 | rate 10 6 | auto_increment_key num 7 | sample {"data":"mydata"} 8 | 9 | 10 | 36 | 37 | 42 | 43 | -------------------------------------------------------------------------------- /example/out_file.conf: -------------------------------------------------------------------------------- 1 | 2 | @type forward 3 | 4 | 5 | 6 | @type file 7 | path /var/log/fluentd/out_file_test 8 | format json 9 | buffer_type memory 10 | # compress gzip 11 | # symlink_path /path/to/symlink 12 | append false 13 | 14 | -------------------------------------------------------------------------------- /example/out_forward.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | 7 | @type forward 8 | 9 | 10 | # first server 11 | host 127.0.0.1 12 | port 24224 13 | 14 | # 15 | # # second server 16 | # host localhost 17 | # port 24225 18 | # 19 | # 20 | # # second server 21 | # host localhost 22 | # port 24226 23 | # standby 24 | # 25 | 26 | flush_interval 0 27 | send_timeout 60 28 | heartbeat_type udp 29 | heartbeat_interval 1 30 | recover_wait 10 31 | hard_timeout 60 32 | expire_dns_cache nil 33 | phi_threshold 16 34 | phi_failure_detector true 35 | 36 | -------------------------------------------------------------------------------- /example/out_forward_buf_file.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | 7 | @type monitor_agent 8 | emit_interval 5 9 | 10 | 11 | 12 | @type forward 13 | buffer_path /tmp/fluentd.forward 14 | buffer_type file 15 | flush_interval 5 16 | send_timeout 60 17 | heartbeat_type tcp 18 | heartbeat_interval 1 19 | 20 | host 127.0.0.1 21 | port 24224 22 | 23 | 24 | -------------------------------------------------------------------------------- /example/out_forward_heartbeat_none.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | 7 | @type forward 8 | heartbeat_type none 9 | 10 | host 127.0.0.1 11 | port 24224 12 | 13 | 14 | flush_mode immediate 15 | 16 | 17 | -------------------------------------------------------------------------------- /example/out_forward_sd.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | 7 | @type forward 8 | 9 | 10 | @type file 11 | path "#{Dir.pwd}/example/sd.yaml" 12 | 13 | 14 | 15 | flush_interval 1 16 | 17 | 18 | -------------------------------------------------------------------------------- /example/out_forward_shared_key.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | @type sample 7 | tag test2 8 | 9 | 10 | 11 | @type forward 12 | flush_interval 0 13 | 14 | self_hostname output.testing.local 15 | shared_key secure_communication_is_awesome 16 | 17 | 18 | host 127.0.0.1 19 | port 24224 20 | 21 | 22 | 23 | 24 | @type forward 25 | flush_interval 0 26 | 27 | self_hostname output-fail.testing.local 28 | shared_key secure_communication_is_not_awesome 29 | # input plugin shows warning for wrong shared_key 30 | # 2016-08-08 16:27:00 +0900 [warn]: Shared key mismatch address="127.0.0.1" hostname="output-fail.testing.local" 31 | 32 | 33 | host 127.0.0.1 34 | port 24224 35 | 36 | 37 | -------------------------------------------------------------------------------- /example/out_forward_tls.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | 7 | @type forward 8 | transport tls 9 | tls_insecure_mode true 10 | 11 | # first server 12 | host 127.0.0.1 13 | port 24224 14 | 15 | 16 | flush_interval 0 17 | 18 | 19 | -------------------------------------------------------------------------------- /example/out_forward_users.conf: -------------------------------------------------------------------------------- 1 | 2 | @type sample 3 | tag test 4 | 5 | 6 | @type sample 7 | tag test2 8 | 9 | 10 | @type sample 11 | tag test3 12 | 13 | 14 | 15 | @type forward 16 | flush_interval 0 17 | 18 | self_hostname output.testing.local 19 | shared_key secure_communication_is_awesome 20 | 21 | 22 | host 127.0.0.1 23 | port 24224 24 | username user1 25 | password yes_this_is_user1 26 | 27 | 28 | 29 | 30 | @type forward 31 | flush_interval 0 32 | 33 | self_hostname output-alt1.testing.local 34 | shared_key secure_communication_is_awesome 35 | 36 | 37 | host 127.0.0.1 38 | port 24224 39 | username user1 40 | password yes_this_is_user1 41 | 42 | 43 | host 127.0.0.1 44 | port 24224 45 | username user2 46 | password yes_this_is_really_user2 47 | 48 | 49 | 50 | 51 | @type forward 52 | flush_interval 0 53 | 54 | self_hostname output-fail.testing.local 55 | shared_key secure_communication_is_awesome 56 | 57 | 58 | host 127.0.0.1 59 | port 24224 60 | username user3 61 | password no_there_are_not_such_user 62 | # input plugin warns authentication erro: 63 | # [warn]: Authentication failed address="127.0.0.1" hostname="output-fail.testing.local" username="user3" 64 | 65 | 66 | -------------------------------------------------------------------------------- /example/out_null.conf: -------------------------------------------------------------------------------- 1 | # 2 | # bundle exec bin/fluentd -c example/out_buffered_null.conf 3 | # (+ --emit-error-log-interval 10) 4 | 5 | @type sample 6 | tag sample 7 | rate 500000000 8 | sample [ 9 | {"message": "aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa"}, 10 | {"message": "bbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbbb"}, 11 | {"message": "ccccccccccccccccccccccccccccccccccccccccccccccccccccccccccccc"} 12 | ] 13 | 14 | 15 | 16 | @type null 17 | 18 | flush_interval 60s 19 | chunk_limit_size 1k 20 | total_limit_size 4k 21 | 22 | 23 | 24 | 32 | 33 | 34 | @type relabel 35 | @label error_log 36 | 37 | -------------------------------------------------------------------------------- /example/sd.yaml: -------------------------------------------------------------------------------- 1 | - 'host': 127.0.0.1 2 | 'port': 24224 3 | 'weight': 1 4 | 'name': server1 5 | - 'host': 127.0.0.1 6 | 'port': 24225 7 | 'weight': 1 8 | 'name': server2 9 | -------------------------------------------------------------------------------- /example/secondary_file.conf: -------------------------------------------------------------------------------- 1 | 2 | rpc_endpoint 0.0.0.0:24444 3 | 4 | 5 | 6 | @type sample 7 | tag test 8 | 9 | 10 | 11 | @type forward 12 | @label @raw 13 | 14 | 15 | 20 | 21 | 22 | @type forward 23 | 24 | 25 | @type memory 26 | timekey 2s 27 | timekey_wait 1s 28 | flush_mode interval 29 | flush_interval 1s 30 | 31 | 32 | 33 | host 0.0.0.0 34 | port 24224 35 | 36 | 37 | 38 | @type secondary_file 39 | directory log/secondary/ 40 | basename ${tag}_%Y%m%d%L_${message} 41 | 42 | 43 | -------------------------------------------------------------------------------- /example/suppress_config_dump.conf: -------------------------------------------------------------------------------- 1 | 2 | suppress_config_dump false 3 | 4 | 5 | 6 | @type stdout 7 | 8 | -------------------------------------------------------------------------------- /example/v1_literal_example.conf: -------------------------------------------------------------------------------- 1 | 2 | key1 'text' # text 3 | key2 '\'' # ' (1 char) 4 | key3 '\\' # \ (1 char) 5 | key4 '\t' # \t (2 char) 6 | key5 '\[' # \[ (2 char) 7 | key6 '\\[' # \[ (2 char) 8 | key7 '#t' # #t (2 char) 9 | key8 '\#{test}' # \#{test} (8 char) 10 | key9 '#{test}' # #{test} (7 char) 11 | key10 '\[(? 13 | 14 | key1 "text" # text 15 | key2 "\"" # " (1 char) 16 | key3 "\\" # \ (1 char) 17 | key4 "\t" # TAB (1 char) 18 | key5 "\[" # [ (1 char) 19 | key6 "\\[" # \[ (2 char) 20 | key7 "#t" # #t (2 char) 21 | key8 "\#{test}" # #{test} (7 char) 22 | key9 "#{test}" # replaced by eval('test') 23 | key10 "\\[(? 25 | 26 | key1 text # text 27 | key2 \ # \ (1 char) 28 | key3 \\ # \\ (2 char) 29 | key4 \t # \t (2 char) 30 | key5 \[ # \[ (2 char) 31 | key6 \\[ # \\[ (3 char) 32 | key7 #t # #t (2 char) 33 | key8 \#{test} # \#{test} (8 char) 34 | key9 #{test} # #{test} (7 char) 35 | key10 \[(? 37 | -------------------------------------------------------------------------------- /example/worker_section.conf: -------------------------------------------------------------------------------- 1 | 2 | workers 4 3 | root_dir /path/fluentd/root 4 | 5 | 6 | # top-level sections works on all workers in parallel 7 | @type forward 8 | port 24224 9 | 10 | 11 | # this sections also works on all workers in parallel 12 | @type stdout 13 | 14 | worker_id_key worker_id 15 | 16 | 17 | 18 | # this section works only on first worker process 19 | 20 | @type tail 21 | format none 22 | path /var/log/fluentd_test.log 23 | pos_file /var/log/fluentd_test.pos 24 | tag tail 25 | rotate_wait 5 26 | read_from_head true 27 | refresh_interval 60 28 | 29 | 30 | 31 | @type stdout 32 | 33 | worker_id_key worker_id 34 | 35 | 36 | 37 | -------------------------------------------------------------------------------- /lib/fluent/command/bundler_injection.rb: -------------------------------------------------------------------------------- 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 'rbconfig' 18 | 19 | if ENV['BUNDLE_BIN_PATH'] 20 | puts 'error: You seem to use `bundle exec` already.' 21 | exit 1 22 | else 23 | begin 24 | bundle_bin = Gem::Specification.find_by_name('bundler').bin_file('bundle') 25 | rescue Gem::LoadError => e 26 | puts "error: #{e}" 27 | exit 1 28 | end 29 | ruby_bin = RbConfig.ruby 30 | system("#{ruby_bin} #{bundle_bin} install") 31 | unless $?.success? 32 | exit $?.exitstatus 33 | end 34 | 35 | cmdline = [ 36 | ruby_bin, 37 | bundle_bin, 38 | 'exec', 39 | ruby_bin, 40 | File.expand_path(File.join(File.dirname(__FILE__), 'fluentd.rb')), 41 | ] + ARGV 42 | 43 | exec(*cmdline) 44 | exit! 127 45 | end 46 | -------------------------------------------------------------------------------- /lib/fluent/compat/detach_process_mixin.rb: -------------------------------------------------------------------------------- 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 Compat 19 | module DetachProcessMixin 20 | def detach_process 21 | log.warn "#{__method__} is not supported in this version. ignored." 22 | yield 23 | end 24 | end 25 | 26 | module DetachMultiProcessMixin 27 | def detach_multi_process 28 | log.warn "#{__method__} is not supported in this version. ignored." 29 | yield 30 | end 31 | end 32 | end 33 | end 34 | -------------------------------------------------------------------------------- /lib/fluent/compat/input.rb: -------------------------------------------------------------------------------- 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/plugin' 18 | require 'fluent/plugin/input' 19 | require 'fluent/process' 20 | require 'fluent/compat/call_super_mixin' 21 | 22 | module Fluent 23 | module Compat 24 | class Input < Fluent::Plugin::Input 25 | # TODO: warn when deprecated 26 | 27 | def initialize 28 | super 29 | unless self.class.ancestors.include?(Fluent::Compat::CallSuperMixin) 30 | self.class.prepend Fluent::Compat::CallSuperMixin 31 | end 32 | end 33 | 34 | # These definitions are to get instance methods of superclass of 3rd party plugins 35 | # to make it sure to call super 36 | def start 37 | super 38 | end 39 | 40 | def before_shutdown 41 | super 42 | end 43 | 44 | def shutdown 45 | super 46 | end 47 | end 48 | end 49 | end 50 | -------------------------------------------------------------------------------- /lib/fluent/compat/output_chain.rb: -------------------------------------------------------------------------------- 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 'singleton' 18 | 19 | module Fluent 20 | module Compat 21 | # TODO: remove when old plugin API are removed 22 | class NullOutputChain 23 | include Singleton 24 | 25 | def next 26 | end 27 | end 28 | 29 | class OutputChain 30 | def initialize(array, tag, es, chain=NullOutputChain.instance) 31 | @array = array 32 | @tag = tag 33 | @es = es 34 | @offset = 0 35 | @chain = chain 36 | end 37 | 38 | def next 39 | if @array.length <= @offset 40 | return @chain.next 41 | end 42 | @offset += 1 43 | @array[@offset-1].emit_events(@tag, @es) 44 | self.next 45 | end 46 | end 47 | 48 | class CopyOutputChain < OutputChain 49 | def next 50 | if @array.length <= @offset 51 | return @chain.next 52 | end 53 | @offset += 1 54 | es = @array.length > @offset ? @es.dup : @es 55 | @array[@offset-1].emit_events(@tag, es) 56 | self.next 57 | end 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /lib/fluent/compat/parser_utils.rb: -------------------------------------------------------------------------------- 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/plugin_helper/compat_parameters' 18 | 19 | module Fluent 20 | module Compat 21 | module ParserUtils 22 | PARSER_PARAMS = Fluent::PluginHelper::CompatParameters::PARSER_PARAMS 23 | 24 | def self.convert_parser_conf(conf) 25 | return if conf.elements(name: 'parse').first 26 | 27 | parser_params = {} 28 | PARSER_PARAMS.each do |older, newer| 29 | next unless newer 30 | if conf.has_key?(older) 31 | parser_params[newer] = conf[older] 32 | end 33 | end 34 | unless parser_params.empty? 35 | conf.elements << Fluent::Config::Element.new('parse', '', parser_params, []) 36 | end 37 | end 38 | end 39 | end 40 | end 41 | -------------------------------------------------------------------------------- /lib/fluent/compat/record_filter_mixin.rb: -------------------------------------------------------------------------------- 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 Compat 19 | module RecordFilterMixin 20 | def filter_record(tag, time, record) 21 | end 22 | 23 | def format_stream(tag, es) 24 | out = '' 25 | es.each {|time,record| 26 | tag_temp = tag.dup 27 | filter_record(tag_temp, time, record) 28 | out << format(tag_temp, time, record) 29 | } 30 | out 31 | end 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/fluent/compat/set_tag_key_mixin.rb: -------------------------------------------------------------------------------- 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/config/error' 18 | require 'fluent/config/types' 19 | require 'fluent/compat/record_filter_mixin' 20 | 21 | module Fluent 22 | module Compat 23 | module SetTagKeyMixin 24 | include RecordFilterMixin 25 | 26 | attr_accessor :include_tag_key, :tag_key 27 | 28 | def configure(conf) 29 | @include_tag_key = false 30 | 31 | super 32 | 33 | if s = conf['include_tag_key'] 34 | include_tag_key = Fluent::Config.bool_value(s) 35 | raise Fluent::ConfigError, "Invalid boolean expression '#{s}' for include_tag_key parameter" if include_tag_key.nil? 36 | 37 | @include_tag_key = include_tag_key 38 | end 39 | 40 | @tag_key = conf['tag_key'] || 'tag' if @include_tag_key 41 | end 42 | 43 | def filter_record(tag, time, record) 44 | super 45 | 46 | record[@tag_key] = tag if @include_tag_key 47 | end 48 | end 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /lib/fluent/compat/string_util.rb: -------------------------------------------------------------------------------- 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 Compat 19 | module StringUtil 20 | def match_regexp(regexp, string) 21 | begin 22 | return regexp.match(string) 23 | rescue ArgumentError => e 24 | raise e unless e.message.index("invalid byte sequence in".freeze).zero? 25 | $log.info "invalid byte sequence is replaced in `#{string}`" 26 | string = string.scrub('?') 27 | retry 28 | end 29 | return true 30 | end 31 | module_function :match_regexp 32 | end 33 | end 34 | end 35 | -------------------------------------------------------------------------------- /lib/fluent/compat/structured_format_mixin.rb: -------------------------------------------------------------------------------- 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 Compat 19 | module StructuredFormatMixin 20 | def format(tag, time, record) 21 | filter_record(tag, time, record) 22 | format_record(record) 23 | end 24 | end 25 | end 26 | end 27 | -------------------------------------------------------------------------------- /lib/fluent/config/error.rb: -------------------------------------------------------------------------------- 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 | class ConfigError < StandardError 19 | end 20 | 21 | class ConfigParseError < ConfigError 22 | end 23 | 24 | class ObsoletedParameterError < ConfigError 25 | end 26 | 27 | class SetNil < Exception 28 | end 29 | 30 | class SetDefault < Exception 31 | end 32 | 33 | class NotFoundPluginError < ConfigError 34 | attr_reader :type, :kind 35 | 36 | def initialize(msg, type: nil, kind: nil) 37 | @msg = msg 38 | @type = type 39 | @kind = kind 40 | 41 | super(msg) 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/fluent/config/yaml_parser.rb: -------------------------------------------------------------------------------- 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/config/yaml_parser/loader' 18 | require 'fluent/config/yaml_parser/parser' 19 | require 'pathname' 20 | 21 | module Fluent 22 | module Config 23 | module YamlParser 24 | def self.parse(path) 25 | context = Kernel.binding 26 | 27 | unless context.respond_to?(:use_nil) 28 | context.define_singleton_method(:use_nil) do 29 | raise Fluent::SetNil 30 | end 31 | end 32 | 33 | unless context.respond_to?(:use_default) 34 | context.define_singleton_method(:use_default) do 35 | raise Fluent::SetDefault 36 | end 37 | end 38 | 39 | unless context.respond_to?(:hostname) 40 | context.define_singleton_method(:hostname) do 41 | Socket.gethostname 42 | end 43 | end 44 | 45 | unless context.respond_to?(:worker_id) 46 | context.define_singleton_method(:worker_id) do 47 | ENV['SERVERENGINE_WORKER_ID'] || '' 48 | end 49 | end 50 | 51 | s = Fluent::Config::YamlParser::Loader.new(context).load(Pathname.new(path)) 52 | Fluent::Config::YamlParser::Parser.new(s).build.to_element 53 | end 54 | end 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /lib/fluent/config/yaml_parser/fluent_value.rb: -------------------------------------------------------------------------------- 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 Config 19 | module YamlParser 20 | module FluentValue 21 | JsonValue = Struct.new(:val) do 22 | def to_s 23 | val.to_json 24 | end 25 | 26 | def to_element 27 | to_s 28 | end 29 | end 30 | 31 | StringValue = Struct.new(:val, :context) do 32 | def to_s 33 | context.instance_eval("\"#{val}\"") 34 | rescue Fluent::SetNil => _ 35 | '' 36 | rescue Fluent::SetDefault => _ 37 | ':default' 38 | end 39 | 40 | def to_element 41 | to_s 42 | end 43 | end 44 | end 45 | end 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /lib/fluent/counter.rb: -------------------------------------------------------------------------------- 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/counter/client' 18 | require 'fluent/counter/server' 19 | 20 | module Fluent 21 | module Counter 22 | end 23 | end 24 | -------------------------------------------------------------------------------- /lib/fluent/counter/base_socket.rb: -------------------------------------------------------------------------------- 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 'cool.io' 18 | require 'fluent/msgpack_factory' 19 | 20 | module Fluent 21 | module Counter 22 | class BaseSocket < Coolio::TCPSocket 23 | def packed_write(data) 24 | write pack(data) 25 | end 26 | 27 | def on_read(data) 28 | Fluent::MessagePackFactory.msgpack_unpacker.feed_each(data) do |d| 29 | on_message d 30 | end 31 | end 32 | 33 | def on_message(data) 34 | raise NotImplementedError 35 | end 36 | 37 | private 38 | 39 | def pack(data) 40 | Fluent::MessagePackFactory.msgpack_packer.pack(data) 41 | end 42 | end 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/fluent/daemon.rb: -------------------------------------------------------------------------------- 1 | #!/usr/bin/env ruby 2 | # -*- coding: utf-8 -*- 3 | 4 | here = File.dirname(__FILE__) 5 | $LOAD_PATH << File.expand_path(File.join(here, '..')) 6 | 7 | require 'serverengine' 8 | require 'fluent/supervisor' 9 | 10 | server_module = Fluent.const_get(ARGV[0]) 11 | worker_module = Fluent.const_get(ARGV[1]) 12 | params = JSON.parse(ARGV[2]) 13 | ServerEngine::Daemon.run_server(server_module, worker_module) { Fluent::Supervisor.serverengine_config(params) } 14 | -------------------------------------------------------------------------------- /lib/fluent/env.rb: -------------------------------------------------------------------------------- 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 'securerandom' 18 | 19 | require 'serverengine/utils' 20 | require 'fluent/oj_options' 21 | 22 | module Fluent 23 | DEFAULT_CONFIG_PATH = ENV['FLUENT_CONF'] || '/etc/fluent/fluent.conf' 24 | DEFAULT_CONFIG_INCLUDE_DIR = ENV["FLUENT_CONF_INCLUDE_DIR"] || '/etc/fluent/conf.d' 25 | DEFAULT_PLUGIN_DIR = ENV['FLUENT_PLUGIN'] || '/etc/fluent/plugin' 26 | DEFAULT_SOCKET_PATH = ENV['FLUENT_SOCKET'] || '/var/run/fluent/fluent.sock' 27 | DEFAULT_BACKUP_DIR = ENV['FLUENT_BACKUP_DIR'] || '/tmp/fluent' 28 | DEFAULT_OJ_OPTIONS = Fluent::OjOptions.load_env 29 | DEFAULT_DIR_PERMISSION = 0755 30 | DEFAULT_FILE_PERMISSION = 0644 31 | INSTANCE_ID = ENV['FLUENT_INSTANCE_ID'] || SecureRandom.uuid 32 | 33 | def self.windows? 34 | ServerEngine.windows? 35 | end 36 | 37 | def self.linux? 38 | RUBY_PLATFORM.include?("linux") 39 | end 40 | 41 | def self.macos? 42 | RUBY_PLATFORM.include?("darwin") 43 | end 44 | end 45 | -------------------------------------------------------------------------------- /lib/fluent/error.rb: -------------------------------------------------------------------------------- 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 | class UnrecoverableError < StandardError 19 | def initialize(error_message = nil) 20 | @message = error_message || "an unrecoverable error occurs in Fluentd process" 21 | end 22 | 23 | def to_s 24 | @message 25 | end 26 | end 27 | 28 | class InvalidRootDirectory < UnrecoverableError 29 | end 30 | 31 | class InvalidLockDirectory < UnrecoverableError 32 | end 33 | 34 | # For internal use 35 | class UncatchableError < Exception 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /lib/fluent/ext_monitor_require.rb: -------------------------------------------------------------------------------- 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 | # To avoid duplicated requirements, extract this logic as file. 18 | 19 | if Gem::Version.create(RUBY_VERSION) >= Gem::Version.create('2.7.0') 20 | require 'monitor' 21 | else 22 | begin 23 | # monitor_ext is bundled since ruby 2.7.0 24 | require 'ext_monitor' 25 | rescue LoadError => _ 26 | require 'monitor' 27 | end 28 | end 29 | -------------------------------------------------------------------------------- /lib/fluent/filter.rb: -------------------------------------------------------------------------------- 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/compat/filter' 18 | 19 | module Fluent 20 | Filter = Fluent::Compat::Filter 21 | end 22 | -------------------------------------------------------------------------------- /lib/fluent/formatter.rb: -------------------------------------------------------------------------------- 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/compat/formatter' 18 | 19 | module Fluent 20 | Formatter = Fluent::Compat::Formatter 21 | TextFormatter = Fluent::Compat::TextFormatter 22 | # deprecate_constant is ruby 2.3 feature 23 | end 24 | -------------------------------------------------------------------------------- /lib/fluent/input.rb: -------------------------------------------------------------------------------- 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/compat/input' 18 | 19 | module Fluent 20 | Input = Fluent::Compat::Input 21 | end 22 | -------------------------------------------------------------------------------- /lib/fluent/label.rb: -------------------------------------------------------------------------------- 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/agent' 18 | 19 | module Fluent 20 | class Label < Agent 21 | def initialize(name, log:) 22 | super(log: log) 23 | 24 | @context = name 25 | @root_agent = nil 26 | end 27 | 28 | attr_accessor :root_agent 29 | 30 | def configure(conf) 31 | super 32 | 33 | if conf.elements('match').size == 0 34 | raise ConfigError, "Missing sections in