From 5ea88300dd9dddbccdc5fef6893ecda08ce83c93 Mon Sep 17 00:00:00 2001 From: pengln Date: Thu, 18 Nov 2021 14:03:38 +0800 Subject: [PATCH 1/2] =?UTF-8?q?#1001686=20Filebeat=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=87=87=E9=9B=86quick=E6=97=A5=E5=BF=97=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../templates/filebeat-quick-template.yml | 62 +++++++++++++++++++ playbooks/roles/filebeat/vars/main.yml | 2 + 2 files changed, 64 insertions(+) create mode 100644 playbooks/roles/filebeat/templates/filebeat-quick-template.yml diff --git a/playbooks/roles/filebeat/templates/filebeat-quick-template.yml b/playbooks/roles/filebeat/templates/filebeat-quick-template.yml new file mode 100644 index 0000000..ac51cb5 --- /dev/null +++ b/playbooks/roles/filebeat/templates/filebeat-quick-template.yml @@ -0,0 +1,62 @@ +path.data: {{ work_path }}/data3 +filebeat.registry.path: {{ work_path }}/data3/registry/quick-{{ instance_name }} + +queue.mem: + events: 512 + flush.min_events: 128 + flush.timeout: 5s + +filebeat.inputs: +{% for log in quicklog %} +- type: log + paths: + - {{ log }} + fields: + source: quick + harvester_buffer_size: 1638400 + tail_files: {{ tail_files | default(true) | string | lower }} +{% endfor %} + +max_procs: {{ max_procs | default(2) }} + +filebeat.config.modules: + # Glob pattern for configuration loading + path: ${path.config}/modules.d/*.yml + + # Set to true to enable config reloading + reload.enabled: false + + # Period on which files under path should be checked for changes + #reload.period: 10s + +# ======================= Elasticsearch template setting ======================= +setup.template.name: "quick" +setup.template.pattern: "quick-*" + +# ---------------------------- Elasticsearch Output ---------------------------- +output.elasticsearch: + hosts: {{ quick_es_hosts }} + index: "quick-{{ instance_name }}-%{[fields.source]}-%{+yyyy.MM.dd}" + pipeline: "quicklog" + username: {{ quick_es_user }} + password: {{ quick_es_passwd }} + bulk_max_size: 1500 + compression_level: {{ compression_level | default(0) }} + worker: 1 + + +# ================================= Processors ================================= +processors: + - add_host_metadata: + when.not.contains.tags: forwarded + - add_cloud_metadata: ~ + - add_docker_metadata: ~ + - add_kubernetes_metadata: ~ + - dissect: + tokenizer: "/%{}/%{}/%{}/%{}/%{}/%{zone_id}_%{server_id}_%{log_t}.txt" + field: "log.file.path" + target_prefix: "" + - dissect: + tokenizer: "%{date} %{+date->} %{log_id->} %{account_id->} %{role_id->} %{role_name->} %{spid->} %{channel->} %{col1->} %{col2->} %{col3->} %{col4->} %{col5->} %{col6->} %{col7->} %{col8->} %{col9->} %{col10->} %{col11->} %{col12->} %{col13->}" + field: "message" + target_prefix: "" \ No newline at end of file diff --git a/playbooks/roles/filebeat/vars/main.yml b/playbooks/roles/filebeat/vars/main.yml index 5959b0c..53a7342 100644 --- a/playbooks/roles/filebeat/vars/main.yml +++ b/playbooks/roles/filebeat/vars/main.yml @@ -14,6 +14,8 @@ gwlogs: - "81" mgrlogs: - "/data/game/htdocs/center/manager/storage/cp/logs/*.log" +quicklog: + - "/data/game/sync/quick/filebeat/*.txt" config_files: - "gateway-nginx" - "manager" \ No newline at end of file -- 2.40.1 From 6eb8dd6abbe215d2e0e307667265bc4b27d7aeb2 Mon Sep 17 00:00:00 2001 From: pengln Date: Thu, 18 Nov 2021 14:26:10 +0800 Subject: [PATCH 2/2] =?UTF-8?q?#1001686=20Filebeat=E5=A2=9E=E5=8A=A0?= =?UTF-8?q?=E9=87=87=E9=9B=86quick=E6=97=A5=E5=BF=97=E7=9A=84=E6=A8=A1?= =?UTF-8?q?=E6=9D=BF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- playbooks/roles/filebeat/templates/filebeat-quick-template.yml | 2 +- playbooks/roles/supervisor/vars/main.yml | 1 + 2 files changed, 2 insertions(+), 1 deletion(-) diff --git a/playbooks/roles/filebeat/templates/filebeat-quick-template.yml b/playbooks/roles/filebeat/templates/filebeat-quick-template.yml index ac51cb5..7bbedf0 100644 --- a/playbooks/roles/filebeat/templates/filebeat-quick-template.yml +++ b/playbooks/roles/filebeat/templates/filebeat-quick-template.yml @@ -59,4 +59,4 @@ processors: - dissect: tokenizer: "%{date} %{+date->} %{log_id->} %{account_id->} %{role_id->} %{role_name->} %{spid->} %{channel->} %{col1->} %{col2->} %{col3->} %{col4->} %{col5->} %{col6->} %{col7->} %{col8->} %{col9->} %{col10->} %{col11->} %{col12->} %{col13->}" field: "message" - target_prefix: "" \ No newline at end of file + target_prefix: "" diff --git a/playbooks/roles/supervisor/vars/main.yml b/playbooks/roles/supervisor/vars/main.yml index 01819f5..4326286 100644 --- a/playbooks/roles/supervisor/vars/main.yml +++ b/playbooks/roles/supervisor/vars/main.yml @@ -6,3 +6,4 @@ work_path: "/data/opt/filebeat/{{ instance_name }}" filebeat_configs: - "gateway-nginx" - "manager" + - "quick" -- 2.40.1