@thinkingai/ae-cli 6.1.30 → 6.1.32
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +11 -5
- package/README.zh.md +11 -5
- package/bin/ai-monitor.js +2 -0
- package/dist/ai-monitor-MKMHSSNI.js +32 -0
- package/dist/ai-monitor.js +135 -0
- package/dist/{auth-ADZHUIJR.js → auth-CZHHPZOQ.js} +10 -9
- package/dist/{automation-FD2QZUP6.js → automation-FLCPFMN4.js} +4 -4
- package/dist/{capability-QXFRJYZD.js → capability-64KVJFIA.js} +27 -31
- package/dist/{chunk-YULUBP3R.js → chunk-3ULDJJTZ.js} +1 -1
- package/dist/{chunk-HRUOV6EQ.js → chunk-4XKTRCRK.js} +15 -15
- package/dist/{chunk-JSBLCLFE.js → chunk-5M5LBRR3.js} +1 -1
- package/dist/chunk-6M7ZEDT2.js +182 -0
- package/dist/{chunk-KPQY44JQ.js → chunk-AWW2T2WL.js} +3 -0
- package/dist/chunk-BNBCMCYN.js +563 -0
- package/dist/chunk-CF6JTT2U.js +64 -0
- package/dist/{chunk-CG773QXN.js → chunk-DWBYNGSR.js} +564 -314
- package/dist/{chunk-VDICGXCY.js → chunk-F2VFZUGG.js} +2 -2
- package/dist/{chunk-TFORY6WY.js → chunk-FCAA7I2D.js} +2 -2
- package/dist/{chunk-SOSFRU3O.js → chunk-HTZ2MLYA.js} +47 -21
- package/dist/{chunk-AWVZTN2B.js → chunk-HVMCPKOZ.js} +1 -1
- package/dist/chunk-IDDWEZ7F.js +1285 -0
- package/dist/{chunk-E25OSZLJ.js → chunk-KTJXD27G.js} +2 -2
- package/dist/{chunk-AVXDJAFC.js → chunk-NLEXY2TM.js} +47 -12
- package/dist/{chunk-YVG6QD3V.js → chunk-P7QDCWJ6.js} +98 -7
- package/dist/{chunk-EUFP4M2A.js → chunk-T7WF4HYW.js} +84 -32
- package/dist/{chunk-Y3AM6LIO.js → chunk-TMQGS4TO.js} +15 -10
- package/dist/{compat-check-HERBTQZN.js → compat-check-ZJNCMNQV.js} +2 -2
- package/dist/{config-E3KANXMK.js → config-FSH2NMNZ.js} +25 -12
- package/dist/{context-CDB5H5PD.js → context-YAQG6YQC.js} +2 -2
- package/dist/{evaluation-LR4YDYWL.js → evaluation-2JSF4V47.js} +13 -158
- package/dist/index.js +81 -583
- package/dist/{memory-SNFR5M23.js → memory-VEZZVAAP.js} +4 -4
- package/dist/{metadata-EXQYDZTH.js → metadata-3IWHX3V4.js} +7 -7
- package/dist/{model-KEVCEXWD.js → model-T7H7Q6BG.js} +2 -2
- package/dist/{personal-semantic-preference-ETY3KU2O.js → personal-semantic-preference-YITU23SA.js} +6 -6
- package/dist/{project-semantic-UHRMVOJF.js → project-semantic-MHEXJF3C.js} +15 -13
- package/dist/{sync-XKEBXESC.js → sync-AQHVCSPI.js} +4 -4
- package/dist/{te-agent-S6UQR4IE.js → te-agent-RXI7WOH4.js} +5 -5
- package/dist/{te-analysis-WOFFCIBC.js → te-analysis-CZY74HVF.js} +380 -191
- package/dist/{te-community-R7B6QYOO.js → te-community-DKCYUBCM.js} +6 -6
- package/dist/{te-dataops-KPILYVHA.js → te-dataops-QEH6VE56.js} +3 -3
- package/dist/{te-engage-IAUM6ONX.js → te-engage-WK7WKDKF.js} +6 -6
- package/dist/{te-experiment-TMLRA7B3.js → te-experiment-LH3RPIOE.js} +274 -29
- package/dist/{te-kb-GKWPSLSY.js → te-kb-UPORIOVN.js} +16 -7
- package/dist/{te-system-CYWSK3UN.js → te-system-AL4B4XZL.js} +2 -2
- package/dist/{te-team-ISN52YNG.js → te-team-LLVTO2G4.js} +5 -5
- package/dist/{things-DDQ52Z3Q.js → things-XLMLBYQR.js} +5 -5
- package/dist/{update-CTLNTX35.js → update-7J5UQHSK.js} +3 -3
- package/dist/{workspace-2CKQX2XL.js → workspace-FF2HXJGR.js} +4 -4
- package/package.json +9 -7
- package/skills/ae-ai-monitor/SKILL.md +179 -0
- package/skills/ae-ai-monitor/references/read-commands.md +866 -0
- package/skills/ae-analysis/SKILL.md +10 -4
- package/skills/ae-analysis/references/adhoc_export.md +3 -1
- package/skills/ae-analysis/references/ai_models/path.md +5 -6
- package/skills/ae-analysis/references/ai_models.md +1 -0
- package/skills/ae-analysis/references/analysis_gateway_assets.md +2 -0
- package/skills/ae-analysis/references/asset_search.md +1 -1
- package/skills/ae-analysis/references/bad_case_begin.md +12 -0
- package/skills/ae-analysis/references/bad_case_get.md +12 -0
- package/skills/ae-analysis/references/bad_case_history.md +12 -0
- package/skills/ae-analysis/references/bad_case_list.md +12 -0
- package/skills/ae-analysis/references/bad_case_review.md +51 -0
- package/skills/ae-analysis/references/bad_case_run.md +12 -0
- package/skills/ae-analysis/references/bad_case_submit.md +12 -0
- package/skills/ae-analysis/references/bad_case_submit_to_page.md +12 -0
- package/skills/ae-analysis/references/bad_case_sync_evaluation.md +11 -0
- package/skills/ae-analysis/references/bi_panel_list.md +1 -1
- package/skills/ae-analysis/references/bi_panel_share.md +3 -1
- package/skills/ae-analysis/references/catalog_list.md +2 -0
- package/skills/ae-analysis/references/command_index.md +38 -29
- package/skills/ae-analysis/references/dashboard_daily_report_update.md +2 -0
- package/skills/ae-analysis/references/dashboard_handover.md +3 -1
- package/skills/ae-analysis/references/dashboard_list.md +3 -3
- package/skills/ae-analysis/references/dashboard_report_data_export.md +1 -1
- package/skills/ae-analysis/references/dashboard_share.md +3 -1
- package/skills/ae-analysis/references/dashboard_update.md +3 -2
- package/skills/ae-analysis/references/filter_value_list.md +2 -0
- package/skills/ae-analysis/references/folder_share.md +8 -2
- package/skills/ae-analysis/references/governance_recommendation_run_update.md +3 -1
- package/skills/ae-analysis/references/project_data_power_upsert.md +3 -1
- package/skills/ae-analysis/references/project_mark_time_create.md +2 -0
- package/skills/ae-analysis/references/project_mark_time_update.md +2 -0
- package/skills/ae-analysis/references/project_member_add.md +3 -1
- package/skills/ae-analysis/references/project_member_batch_update.md +3 -1
- package/skills/ae-analysis/references/project_member_handover_run.md +3 -1
- package/skills/ae-analysis/references/project_member_update.md +3 -1
- package/skills/ae-analysis/references/project_owner_update.md +3 -1
- package/skills/ae-analysis/references/project_role_upsert.md +5 -3
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki.md +16 -1
- package/skills/ae-analysis/references/project_semantic_knowledge_wiki_plan_schema.md +14 -1
- package/skills/ae-analysis/references/project_space_share.md +8 -2
- package/skills/ae-analysis/references/property_get.md +2 -0
- package/skills/ae-analysis/references/public_link_list.md +3 -1
- package/skills/ae-analysis/references/query_cancel.md +4 -1
- package/skills/ae-analysis/references/report_data_run.md +1 -1
- package/skills/ae-analysis/references/report_list.md +3 -3
- package/skills/ae-analysis/references/scenario_append.md +2 -2
- package/skills/ae-analysis/references/scenario_collect.md +15 -4
- package/skills/ae-analysis/references/scenario_list.md +2 -1
- package/skills/ae-analysis/references/system_oauth2_update.md +3 -1
- package/skills/ae-analysis/references/system_third_party_login_upsert.md +4 -2
- package/skills/ae-analysis/references/user_tag_create.md +4 -1
- package/skills/ae-analysis/references/user_tag_get.md +2 -0
- package/skills/ae-analysis/references/user_tag_models.md +8 -2
- package/skills/ae-analysis/references/user_tag_update.md +5 -2
- package/skills/ae-analysis/references/virtual_property_create.md +12 -1
- package/skills/ae-analysis/references/virtual_property_sql_rule_update.md +10 -0
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/build-project-semantic-wiki.mjs +55 -13
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/company-kb.mjs +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-rules.md +2 -2
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/default-compile-schema.md +7 -1
- package/skills/ae-analysis/scripts/project-semantic-knowledge-wiki/wait-compile-run.mjs +79 -0
- package/skills/ae-automation/SKILL.md +4 -2
- package/skills/ae-capability/SKILL.md +9 -5
- package/skills/ae-community/SKILL.md +1 -0
- package/skills/ae-dataops/SKILL.md +1 -0
- package/skills/ae-engage/SKILL.md +1 -0
- package/skills/ae-evaluation/SKILL.md +17 -2
- package/skills/ae-experiment/SKILL.md +38 -11
- package/skills/ae-experiment/references/experiment_approval.md +171 -0
- package/skills/ae-experiment/references/manage_experiment.md +11 -2
- package/skills/ae-experiment/references/save_experiment.md +28 -8
- package/skills/ae-experiment/references/save_submit_experiment.md +18 -3
- package/skills/ae-experiment/references/save_submit_external_experiment.md +57 -3
- package/skills/ae-generate-tracking-plan/SKILL.md +5 -0
- package/skills/ae-kb/SKILL.md +5 -3
- package/skills/ae-kb/references/analysis-workflow.md +11 -2
- package/skills/ae-kb/references/query-workflow.md +3 -1
- package/skills/ae-kb/references/versions.md +1 -1
- package/skills/ae-metadata/SKILL.md +1 -0
- package/skills/ae-migrate-tracking-code/SKILL.md +2 -1
- package/skills/ae-team/SKILL.md +1 -1
- package/skills/ae-tracking-matrix/SKILL.md +170 -0
- package/skills/ae-tracking-matrix/assets//345/237/213/347/202/271/346/250/241/347/211/210.xlsx +0 -0
- package/skills/ae-tracking-matrix/i18n.yaml +12 -0
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +93 -0
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +30 -0
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +256 -0
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +213 -0
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +407 -0
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +218 -0
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +112 -0
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +301 -0
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +356 -0
- package/skills/ae-tracking-matrix/references/categories/fishing.md +775 -0
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +89 -0
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +27 -0
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +415 -0
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +133 -0
- package/skills/ae-tracking-matrix/references/categories/merge.md +639 -0
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +406 -0
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +230 -0
- package/skills/ae-tracking-matrix/references/categories/music.md +137 -0
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +414 -0
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +199 -0
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +158 -0
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +546 -0
- package/skills/ae-tracking-matrix/references/categories/rpg.md +195 -0
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +115 -0
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +151 -0
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +260 -0
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +232 -0
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +359 -0
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +365 -0
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +211 -0
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +132 -0
- package/skills/ae-tracking-matrix/references/category-registry.md +77 -0
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +230 -0
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +406 -0
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +128 -0
- package/skills/ae-tracking-matrix/references/eval-cases.md +74 -0
- package/skills/ae-tracking-matrix/references/naming-dict.md +238 -0
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +85 -0
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +142 -0
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +47 -0
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +794 -0
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +94 -0
- package/skills/ae-tracking-matrix/references/scene-routing.md +80 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +3787 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +827 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +655 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +953 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +1128 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +714 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +1268 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +776 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +182 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +2755 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +1182 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +1300 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +1369 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +1692 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +902 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +763 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +1107 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +1532 -0
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +845 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +228 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +149 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +407 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +163 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +149 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +153 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +232 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +314 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +117 -0
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +148 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +645 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +307 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +347 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +72 -0
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +264 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +566 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +409 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +446 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +557 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +457 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +490 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +523 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +484 -0
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +442 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +391 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +91 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +635 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +113 -0
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +466 -0
- package/skills/ae-tracking-matrix/references/standard-base/README.md +22 -0
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +174 -0
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +20 -0
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +7 -0
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +14 -0
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +370 -0
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +47 -0
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +37 -0
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +27 -0
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +23 -0
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +14 -0
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +46 -0
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +13 -0
- package/skills/ae-tracking-matrix/references/system-fields.md +297 -0
- package/skills/ae-tracking-matrix/references/te-field-translations.md +1791 -0
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +232 -0
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +829 -0
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +355 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +283 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +168 -0
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +205 -0
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +75 -0
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +36 -0
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +107 -0
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +114 -0
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +53 -0
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +166 -0
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +674 -0
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +200 -0
- package/skills/ae-tracking-matrix/scripts/plan_types.py +60 -0
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +169 -0
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +296 -0
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +340 -0
- package/dist/chunk-AMBFK2K3.js +0 -28
|
@@ -0,0 +1,645 @@
|
|
|
1
|
+
---
|
|
2
|
+
code: filebeat_logstash_installation
|
|
3
|
+
name: "Filebeat + Logstash Usage Guide"
|
|
4
|
+
wikiToken: FiOpwljqpi2CotkX9ofc7rDRnHc
|
|
5
|
+
parentWikiToken: RjUcwyNY8iQH1dk8SP9cPyz1ngf
|
|
6
|
+
updateTime: 1745310935000
|
|
7
|
+
sourceUrl: https://docs-v2.thinkingdata.cn/?version=6.0&lan=zh-CN&code=filebeat_logstash_installation
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
# Filebeat + Logstash Usage Guide
|
|
11
|
+
|
|
12
|
+
This section mainly introduces the usage method of data transmission tool Filebeat + Logstash:
|
|
13
|
+
|
|
14
|
+
**Before starting integration, you need to read Data Rules first. After becoming familiar with TE data format and data rules, then read this guide for integration.**
|
|
15
|
+
|
|
16
|
+
**Filebeat + Logstash uploaded data must follow TE data format**
|
|
17
|
+
|
|
18
|
+
**Note: Logstash throughput is low. If importing large amounts of historical data, recommend using DataX engine or Logbus tool**
|
|
19
|
+
|
|
20
|
+
### 1. Filebeat + Logstash Introduction
|
|
21
|
+
|
|
22
|
+
Filebeat + Logstash tool is mainly used to import log data to TE backend in real-time, monitor file streams in server log directory. When any log file in the directory has new data generated, send to TE backend in real-time.
|
|
23
|
+
|
|
24
|
+
Logstash is an open-source server-side data processing pipeline that can collect data from multiple sources simultaneously, transform data, then send data to your favorite "repository". Logstash official website introduction
|
|
25
|
+
|
|
26
|
+
Filebeat is a local file log data collector that can monitor log directories or specific log files (tail file). Filebeat provides a lightweight method for forwarding and summarizing logs and files. Filebeat official website introduction
|
|
27
|
+
|
|
28
|
+
Based on Filebeat + Logstash collection flow diagram as shown below:
|
|
29
|
+
|
|
30
|
+
### 2. Filebeat + Logstash Download and Installation
|
|
31
|
+
|
|
32
|
+
**Note: Logstash-6.x or above version, server needs JDK environment**
|
|
33
|
+
|
|
34
|
+
#### 2.2 Logstash Download and Installation
|
|
35
|
+
|
|
36
|
+
Refer to Logstash official website installation documentation, please choose method to download
|
|
37
|
+
|
|
38
|
+
#### 2.3 logstash-output-thinkingdata Plugin
|
|
39
|
+
|
|
40
|
+
**Latest version**: 1.2.0
|
|
41
|
+
|
|
42
|
+
**Update date**: 2023-04-25
|
|
43
|
+
|
|
44
|
+
##### 2.3.1 Install and Uninstall logstash-output-thinkingdata Plugin
|
|
45
|
+
|
|
46
|
+
This plugin checks whether data is json data, packages data and sends to TE
|
|
47
|
+
|
|
48
|
+
Execute in logstash directory:
|
|
49
|
+
|
|
50
|
+
```
|
|
51
|
+
bin/logstash-plugin install logstash-output-thinkingdata
|
|
52
|
+
```
|
|
53
|
+
|
|
54
|
+
Installation needs some time, please wait patiently for installation success, then execute:
|
|
55
|
+
|
|
56
|
+
```
|
|
57
|
+
bin/logstash-plugin list
|
|
58
|
+
```
|
|
59
|
+
|
|
60
|
+
If **logstash-output-thinkingdata** is in the list, it means installation is successful.
|
|
61
|
+
|
|
62
|
+
Other commands as shown:
|
|
63
|
+
|
|
64
|
+
Upgrade plugin can execute:
|
|
65
|
+
|
|
66
|
+
```
|
|
67
|
+
bin/logstash-plugin update logstash-output-thinkingdata
|
|
68
|
+
```
|
|
69
|
+
|
|
70
|
+
Uninstall plugin can execute:
|
|
71
|
+
|
|
72
|
+
```
|
|
73
|
+
bin/logstash-plugin uninstall logstash-output-thinkingdata
|
|
74
|
+
```
|
|
75
|
+
|
|
76
|
+
##### 2.3.2 Change Log
|
|
77
|
+
|
|
78
|
+
###### **v1.2.1 2023/07/26**
|
|
79
|
+
|
|
80
|
+
- Added format validation for data in message
|
|
81
|
+
|
|
82
|
+
###### **v1.2.0 2023/04/25**
|
|
83
|
+
|
|
84
|
+
- Supports multiple data in message
|
|
85
|
+
|
|
86
|
+
###### **v1.1.0 2021/01/27**
|
|
87
|
+
|
|
88
|
+
- Added support for #app_id format in data
|
|
89
|
+
|
|
90
|
+
###### **v1.0.0 2020/06/09**
|
|
91
|
+
|
|
92
|
+
- Receive message passed by Logstash event and send to TE
|
|
93
|
+
|
|
94
|
+
#### 2.4 Filebeat Download and Installation
|
|
95
|
+
|
|
96
|
+
Refer to Filebeat official installation documentation, please choose method to download
|
|
97
|
+
|
|
98
|
+
### 3. Filebeat + Logstash Usage Instructions
|
|
99
|
+
|
|
100
|
+
#### 3.1 Data Preparation
|
|
101
|
+
|
|
102
|
+
1. First, ETL convert the data to be transmitted into TE data format, and write to local or transmit to Kafka cluster. If using Java or other server SDK's write Kafka or local file consumer, data is already correct format, no need to convert again.
|
|
103
|
+
|
|
104
|
+
2. Determine the directory where uploaded data files are stored, or Kafka address and topic, and configure Filebeat + Logstash related configurations. Filebeat + Logstash will monitor file changes in file directory (monitor file creation or tail existing files), or subscribe to data in Kafka.
|
|
105
|
+
|
|
106
|
+
3. Do not directly rename data logs that have been uploaded and stored in monitoring directory. Renaming logs is equivalent to creating new files. Filebeat may re-upload these files, causing data duplication.
|
|
107
|
+
|
|
108
|
+
#### 3.2 Logstash Configuration
|
|
109
|
+
|
|
110
|
+
##### 3.2.1 Logstash Pipeline Configuration
|
|
111
|
+
|
|
112
|
+
Logstash supports running multiple Pipelines simultaneously. Each Pipeline is independent, has its own input output configuration. Pipeline configuration file is located at config/pipelines.yml. If you are currently using Logstash to complete some other log collection work, you can add a Pipeline specifically responsible for collecting TE log data on original Logstash, and send to TE.
|
|
113
|
+
|
|
114
|
+
New Pipeline configuration as follows:
|
|
115
|
+
|
|
116
|
+
```
|
|
117
|
+
# thinkingdata pipeline configuration
|
|
118
|
+
- pipeline.id: thinkingdata-output
|
|
119
|
+
# If uploading user properties core count set to 1, if only uploading event properties can set less than or equal to local cpu count
|
|
120
|
+
pipeline.workers: 1
|
|
121
|
+
# Buffer queue type used
|
|
122
|
+
queue.type: persisted
|
|
123
|
+
# Use different input output configuration
|
|
124
|
+
path.config: "/home/elk/conf/ta_output.conf"
|
|
125
|
+
```
|
|
126
|
+
|
|
127
|
+
More Pipeline configuration official website: Pipeline
|
|
128
|
+
|
|
129
|
+
##### 3.2.2 Logstash Input Output Configuration
|
|
130
|
+
|
|
131
|
+
ta_output.conf reference example:
|
|
132
|
+
|
|
133
|
+
::: tip Note
|
|
134
|
+
|
|
135
|
+
Here scenario is based on files generated by SDK, Logstash output input configuration
|
|
136
|
+
|
|
137
|
+
:::
|
|
138
|
+
|
|
139
|
+
```
|
|
140
|
+
# Use beats as input
|
|
141
|
+
input {
|
|
142
|
+
beats {
|
|
143
|
+
port => "5044"
|
|
144
|
+
}
|
|
145
|
+
}
|
|
146
|
+
# If not server SDK generated or data conforming to TE format, need filter to filter metadata, here recommend ruby plugin filter, fourth module has example
|
|
147
|
+
#filter {
|
|
148
|
+
# if "log4j" in [tags] {
|
|
149
|
+
# ruby {
|
|
150
|
+
# path => "/home/elk/conf/rb/log4j_filter.rb"
|
|
151
|
+
# }
|
|
152
|
+
# }
|
|
153
|
+
#}
|
|
154
|
+
# Use thinkingdata as output
|
|
155
|
+
output{
|
|
156
|
+
thinkingdata {
|
|
157
|
+
url => "http://data_collection_address/logbus"
|
|
158
|
+
appid =>"your AppID"
|
|
159
|
+
}
|
|
160
|
+
}
|
|
161
|
+
```
|
|
162
|
+
|
|
163
|
+
thinkingdata parameter description:
|
|
164
|
+
|
|
165
|
+
**Parameter Name**
|
|
166
|
+
|
|
167
|
+
**Type**
|
|
168
|
+
|
|
169
|
+
**Required**
|
|
170
|
+
|
|
171
|
+
**Default Value**
|
|
172
|
+
|
|
173
|
+
**Description**
|
|
174
|
+
|
|
175
|
+
url
|
|
176
|
+
|
|
177
|
+
string
|
|
178
|
+
|
|
179
|
+
true
|
|
180
|
+
|
|
181
|
+
None
|
|
182
|
+
|
|
183
|
+
TE data receiver address
|
|
184
|
+
|
|
185
|
+
appid
|
|
186
|
+
|
|
187
|
+
string
|
|
188
|
+
|
|
189
|
+
true
|
|
190
|
+
|
|
191
|
+
None
|
|
192
|
+
|
|
193
|
+
Project APPID
|
|
194
|
+
|
|
195
|
+
flush_interval_sec
|
|
196
|
+
|
|
197
|
+
number
|
|
198
|
+
|
|
199
|
+
false
|
|
200
|
+
|
|
201
|
+
2
|
|
202
|
+
|
|
203
|
+
Trigger flush interval time, unit: seconds
|
|
204
|
+
|
|
205
|
+
flush_batch_size
|
|
206
|
+
|
|
207
|
+
number
|
|
208
|
+
|
|
209
|
+
false
|
|
210
|
+
|
|
211
|
+
500
|
|
212
|
+
|
|
213
|
+
Trigger flush json data, unit: records
|
|
214
|
+
|
|
215
|
+
compress
|
|
216
|
+
|
|
217
|
+
number
|
|
218
|
+
|
|
219
|
+
false
|
|
220
|
+
|
|
221
|
+
1
|
|
222
|
+
|
|
223
|
+
Compress data, 0 means no compression, can set in internal network; 1 means gzip compression, default gzip compression
|
|
224
|
+
|
|
225
|
+
uuid
|
|
226
|
+
|
|
227
|
+
boolean
|
|
228
|
+
|
|
229
|
+
false
|
|
230
|
+
|
|
231
|
+
false
|
|
232
|
+
|
|
233
|
+
Whether to enable UUID switch, for deduplication when network fluctuation may occur in short time interval
|
|
234
|
+
|
|
235
|
+
is_filebeat_status_record
|
|
236
|
+
|
|
237
|
+
boolean
|
|
238
|
+
|
|
239
|
+
false
|
|
240
|
+
|
|
241
|
+
true
|
|
242
|
+
|
|
243
|
+
Whether to enable Filebeat monitoring log status, such as offset, file name, etc.
|
|
244
|
+
|
|
245
|
+
##### 3.2.3 Logstash Running Configuration
|
|
246
|
+
|
|
247
|
+
Logstash defaults to use **config/logstash.yml** as running configuration.
|
|
248
|
+
|
|
249
|
+
```
|
|
250
|
+
pipeline.workers: 1
|
|
251
|
+
queue.type: persisted
|
|
252
|
+
queue.drain: true
|
|
253
|
+
```
|
|
254
|
+
|
|
255
|
+
**Recommendations**
|
|
256
|
+
|
|
257
|
+
1. When user_set uploads user properties, please change pipeline.workers value to 1. When workers value is greater than 1, it will cause data processing order change. track events can set greater than 1.
|
|
258
|
+
1. To ensure data transmission does not lose due to program accidental termination, please set queue.type: persisted, represents Logstash used buffer queue type. This configuration can continue to send data in buffer queue after restarting Logstash.
|
|
259
|
+
**More data persistence related can see official website** persistent-queues
|
|
260
|
+
|
|
261
|
+
1. Set queue.drain value to true. This configuration will make Logstash send all data in buffer queue before normal exit.
|
|
262
|
+
**More details can see official website** logstash.yml
|
|
263
|
+
|
|
264
|
+
##### 3.2.4 Logstash Startup
|
|
265
|
+
|
|
266
|
+
In Logstash installation directory:
|
|
267
|
+
|
|
268
|
+
1. Direct startup, use config/pipelines.yml as Pipeline configuration and running configuration
|
|
269
|
+
|
|
270
|
+
```
|
|
271
|
+
bin/logstash
|
|
272
|
+
```
|
|
273
|
+
|
|
274
|
+
2. Specify ta_output.conf as input output configuration file startup, will use config/logstash.yml as running configuration
|
|
275
|
+
|
|
276
|
+
```
|
|
277
|
+
bin/logstash -f /youpath/ta_output.conf
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
3. Background startup
|
|
281
|
+
|
|
282
|
+
```
|
|
283
|
+
nohup bin/logstash -f /youpath/ta_output.conf > /dev/null 2>&1 &
|
|
284
|
+
```
|
|
285
|
+
|
|
286
|
+
More startup, can see Logstash official startup documentation
|
|
287
|
+
|
|
288
|
+
#### 3.3 Filebeat Configuration
|
|
289
|
+
|
|
290
|
+
##### 3.3.1 Filebeat Running Configuration
|
|
291
|
+
|
|
292
|
+
Filebeat reads backend SDK log files. Filebeat default configuration file: filebeat.yml. config/filebeat.yml reference configuration as follows:
|
|
293
|
+
|
|
294
|
+
```
|
|
295
|
+
#======================= Filebeat inputs =========================
|
|
296
|
+
filebeat.shutdown_timeout: 5s
|
|
297
|
+
filebeat.inputs:
|
|
298
|
+
- type: log
|
|
299
|
+
enabled: true
|
|
300
|
+
paths:
|
|
301
|
+
- /var/log/log.*
|
|
302
|
+
#- c:\programdata\elasticsearch\logs\*
|
|
303
|
+
#------------------------- Logstash output ----------------------------
|
|
304
|
+
output.logstash:
|
|
305
|
+
# Can fill one server process, or multiple Logstash processes on multiple servers
|
|
306
|
+
hosts: ["ip1:5044","ip2:5044"]
|
|
307
|
+
loadbalance: false
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
1. shutdown_timeout: Filebeat shutdown time waiting for publisher to complete sending events before closing.
|
|
311
|
+
1. **paths**: Specify logs to monitor. Currently processed according to Go language glob function, no recursive processing for configured directory.
|
|
312
|
+
1. **hosts**: Send address to multiple Logstash hosts. When loadbalance is false similar to primary standby function, true represents load balancing
|
|
313
|
+
1. **loadbalance**: If there is user_set user property upload, do not set loadbalance: true. Setting will use round-robin method to send data to all Logstash, which may cause data order disorder.
|
|
314
|
+
If only importing track events, can set multiple Logstash processes, and can set loadbalance: true. Filebeat default configuration is loadbalance: false
|
|
315
|
+
|
|
316
|
+
Filebeat materials can see: Filebeat official documentation
|
|
317
|
+
|
|
318
|
+
##### 3.3.2 Filebeat Startup
|
|
319
|
+
|
|
320
|
+
After filebeat startup, view related output information:
|
|
321
|
+
|
|
322
|
+
```
|
|
323
|
+
./filebeat -e -c filebeat.yml
|
|
324
|
+
```
|
|
325
|
+
|
|
326
|
+
Background startup
|
|
327
|
+
|
|
328
|
+
```
|
|
329
|
+
nohup ./filebeat -c filebeat.yml > /dev/null 2>&1 &
|
|
330
|
+
```
|
|
331
|
+
|
|
332
|
+
### 4. Case Configuration Reference
|
|
333
|
+
|
|
334
|
+
#### 4.1 Filebeat Monitoring Different Log Format Data Configuration
|
|
335
|
+
|
|
336
|
+
Single Filebeat filebeat.xml can set as follows, running memory about 10 MB. Can also start multiple filebeat processes to monitor different log formats, refer to official website for details
|
|
337
|
+
|
|
338
|
+
```
|
|
339
|
+
#=========================== Filebeat inputs =============================
|
|
340
|
+
|
|
341
|
+
filebeat.inputs:
|
|
342
|
+
- type: log
|
|
343
|
+
enabled: true
|
|
344
|
+
#Monitor directory
|
|
345
|
+
paths:
|
|
346
|
+
- /home/elk/sdk/*/log.*
|
|
347
|
+
#Tag data, Logstash match, no need for filter processing
|
|
348
|
+
tags: ["sdklog"]
|
|
349
|
+
#Data split by special character
|
|
350
|
+
- type: log
|
|
351
|
+
enable: true
|
|
352
|
+
paths: /home/txt/split.*
|
|
353
|
+
#Tag data, Logstash match, need filter processing
|
|
354
|
+
tags: ["split"]
|
|
355
|
+
# log4j received data
|
|
356
|
+
- type: log
|
|
357
|
+
enable: true
|
|
358
|
+
paths: /home/web/logs/*.log
|
|
359
|
+
# Need filter processing
|
|
360
|
+
tags: ["log4j"]
|
|
361
|
+
# log4j received data
|
|
362
|
+
# nginx log data
|
|
363
|
+
- type: log
|
|
364
|
+
enable: true
|
|
365
|
+
paths: /home/web/logs/*.log
|
|
366
|
+
tags: ["nginx"]
|
|
367
|
+
```
|
|
368
|
+
|
|
369
|
+
#### 4.2 Logstash Configuration
|
|
370
|
+
|
|
371
|
+
Check whether Logstash configuration file has error
|
|
372
|
+
|
|
373
|
+
```
|
|
374
|
+
bin/logstash -f /home/elk/ta_output.conf --config.test_and_exit
|
|
375
|
+
```
|
|
376
|
+
|
|
377
|
+
**Note: All ruby plugins in following scripts are written based on ruby syntax. If you are familiar with java, can use custom parser in logbus directory**
|
|
378
|
+
|
|
379
|
+
##### 4.2.1 Server SDK Log
|
|
380
|
+
|
|
381
|
+
ta_output.conf can set as follows
|
|
382
|
+
|
|
383
|
+
```
|
|
384
|
+
input {
|
|
385
|
+
beats {
|
|
386
|
+
port => "5044"
|
|
387
|
+
}
|
|
388
|
+
}
|
|
389
|
+
# Use thinkingdata as output
|
|
390
|
+
output{
|
|
391
|
+
thinkingdata {
|
|
392
|
+
url => "url"
|
|
393
|
+
appid =>"appid"
|
|
394
|
+
# compress => 0
|
|
395
|
+
# uuid => true
|
|
396
|
+
}
|
|
397
|
+
}
|
|
398
|
+
```
|
|
399
|
+
|
|
400
|
+
##### 4.2.2 log4j Log
|
|
401
|
+
|
|
402
|
+
log4j format can set as follows, set according to business log situation:
|
|
403
|
+
|
|
404
|
+
```
|
|
405
|
+
//Log format
|
|
406
|
+
//[%d{yyyy-MM-dd HH:mm:ss.SSS}] Log conforms to TE input time, can also be yyyy-MM-dd HH:mm:ss
|
|
407
|
+
//[%level{length=5}] Log level, debug, info, warn, error
|
|
408
|
+
//[%thread-%tid] Current thread information
|
|
409
|
+
//[%logger] Current log information belongs to class full path
|
|
410
|
+
//[%X{hostName}] Current node hostname. Need to customize through MDC.
|
|
411
|
+
//[%X{ip}] Current node ip. Need to customize through MDC.
|
|
412
|
+
//[%X{userId}] User login unique ID, can set account_id, or other value. TE requires account_id and distinct_id cannot both be empty, can set other properties, see business settings. Need to customize through MDC.
|
|
413
|
+
//[%X{applicationName}] Current application name. Need to customize through MDC.
|
|
414
|
+
//[%F,%L,%C,%M] %F: Current log information belongs to file (class) name, %L: Log information line number in file, %C: Current log belongs to file full class name, %M: Current log belongs to method name
|
|
415
|
+
//[%m] Log detail
|
|
416
|
+
//%ex Exception information
|
|
417
|
+
//%n Line break
|
|
418
|
+
<property name="patternLayout">[%d{yyyy-MM-dd HH:mm:ss.SSS}] [%level{length=5}] [%thread-%tid] [%logger] [%X{hostName}] [%X{ip}] [%X{userId}] [%X{applicationName}] [%F,%L,%C,%M] [%m] ## '%ex'%n
|
|
419
|
+
</property>
|
|
420
|
+
```
|
|
421
|
+
|
|
422
|
+
ta_output.conf configuration
|
|
423
|
+
|
|
424
|
+
```
|
|
425
|
+
input {
|
|
426
|
+
beats {
|
|
427
|
+
port => "5044"
|
|
428
|
+
}
|
|
429
|
+
}
|
|
430
|
+
filter {
|
|
431
|
+
if "log4j" in [tags]{
|
|
432
|
+
#Can also do other filter data processing
|
|
433
|
+
ruby {
|
|
434
|
+
path => "/home/conf/log4j.rb"
|
|
435
|
+
}
|
|
436
|
+
}
|
|
437
|
+
}
|
|
438
|
+
# Use thinkingdata as output
|
|
439
|
+
output{
|
|
440
|
+
thinkingdata {
|
|
441
|
+
url => "url"
|
|
442
|
+
appid =>"appid"
|
|
443
|
+
}
|
|
444
|
+
}
|
|
445
|
+
```
|
|
446
|
+
|
|
447
|
+
/home/conf/log4j.rb script as follows
|
|
448
|
+
|
|
449
|
+
```
|
|
450
|
+
# Here through parameter event can get all attributes in input
|
|
451
|
+
def filter(event)
|
|
452
|
+
_message = event.get('message') #message is your uploaded each log
|
|
453
|
+
begin
|
|
454
|
+
#Here regex out correct data format, if error log recommend put in separate file, error log too long no analysis scenario, and cross line
|
|
455
|
+
#Here data similar to this format _message ="[2020-06-08 23:19:56.003] [INFO] [main-1] [cn.thinkingdata] [x] [123.123.123.123] [x] [x] [StartupInfoLogger.java,50,o)] ## ''"
|
|
456
|
+
mess = /\[(.*?)\] \[(.*?)\] \[(.*?)\] \[(.*?)\] \[(.*?)\] \[(.*?)\] \[(.*?)\] \[(.*?)\] \[(.*?)\] ## '(.*?)'/.match(_message)
|
|
457
|
+
time = mess[1]
|
|
458
|
+
level = mess[2]
|
|
459
|
+
thread = mess[3]
|
|
460
|
+
class_name_all = mess[4]
|
|
461
|
+
event_name = mess[5]
|
|
462
|
+
ip = mess[6]
|
|
463
|
+
account_id = mess[7]
|
|
464
|
+
application_name = mess[8]
|
|
465
|
+
other_mess = mess[9]
|
|
466
|
+
exp = mess[10]
|
|
467
|
+
|
|
468
|
+
if event_name.empty? || account_id.empty?
|
|
469
|
+
return []
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
properties = {
|
|
473
|
+
'level' => level,
|
|
474
|
+
'thread' => thread,
|
|
475
|
+
'application_name' => application_name,
|
|
476
|
+
'class_name_all' => class_name_all,
|
|
477
|
+
'other_mess' => other_mess,
|
|
478
|
+
'exp' => exp
|
|
479
|
+
}
|
|
480
|
+
|
|
481
|
+
data = {
|
|
482
|
+
'#ip' => ip,
|
|
483
|
+
'#time' => time,
|
|
484
|
+
'#account_id'=>account_id,
|
|
485
|
+
'#event_name'=>event_name, #If type is track can use, if no #event_name no upload
|
|
486
|
+
'#type' =>'track', #Can get from file, if in file, confirm whether upload data is user property or event property
|
|
487
|
+
'properties' => properties
|
|
488
|
+
}
|
|
489
|
+
|
|
490
|
+
event.set('message',data.to_json)
|
|
491
|
+
return [event]
|
|
492
|
+
rescue
|
|
493
|
+
# puts _message
|
|
494
|
+
puts "Data does not conform to regex format"
|
|
495
|
+
return [] #No upload
|
|
496
|
+
end
|
|
497
|
+
end
|
|
498
|
+
```
|
|
499
|
+
|
|
500
|
+
##### 4.2.3 Nginx Log
|
|
501
|
+
|
|
502
|
+
First define Nginx log format. If set to json format:
|
|
503
|
+
|
|
504
|
+
```
|
|
505
|
+
input {
|
|
506
|
+
beats {
|
|
507
|
+
port => "5044"
|
|
508
|
+
}
|
|
509
|
+
}
|
|
510
|
+
filter {
|
|
511
|
+
#If same format data no need to judge tags
|
|
512
|
+
if "nginx" in [tags]{
|
|
513
|
+
ruby {
|
|
514
|
+
path => "/home/conf/nginx.rb"
|
|
515
|
+
}
|
|
516
|
+
}
|
|
517
|
+
}
|
|
518
|
+
# Use thinkingdata as output
|
|
519
|
+
output{
|
|
520
|
+
thinkingdata {
|
|
521
|
+
url => "url"
|
|
522
|
+
appid =>"appid"
|
|
523
|
+
}
|
|
524
|
+
}
|
|
525
|
+
```
|
|
526
|
+
|
|
527
|
+
/home/conf/nginx.rb script as follows:
|
|
528
|
+
|
|
529
|
+
```
|
|
530
|
+
require 'date'
|
|
531
|
+
def filter(event)
|
|
532
|
+
#Take similar log information
|
|
533
|
+
# {"accessip_list":"124.207.82.22","client_ip":"123.207.82.22","http_host":"203.195.163.239","@timestamp":"2020-06-03T19:47:42+08:00","method":"GET","url":"/urlpath","status":"304","http_referer":"-","body_bytes_sent":"0","request_time":"0.000","user_agent":"s","total_bytes_sent":"180","server_ip":"10.104.137.230"}
|
|
534
|
+
logdata= event.get('message')
|
|
535
|
+
#Parse log level and request time, and save to event object
|
|
536
|
+
#Parse json format log
|
|
537
|
+
#Get log content
|
|
538
|
+
#Convert to json object
|
|
539
|
+
logInfoJson=JSON.parse logdata
|
|
540
|
+
time = DateTime.parse(logInfoJson['@timestamp']).to_time.localtime.strftime('%Y-%m-%d %H:%M:%S')
|
|
541
|
+
url = logInfoJson['url']
|
|
542
|
+
account_id = logInfoJson['user_agent']
|
|
543
|
+
#event_name
|
|
544
|
+
#account_id or #distinct_id both null, skip upload
|
|
545
|
+
if url.empty? || url == "/" || account_id.empty?
|
|
546
|
+
return []
|
|
547
|
+
end
|
|
548
|
+
properties = {
|
|
549
|
+
"accessip_list" => logInfoJson['accessip_list'],
|
|
550
|
+
"http_host"=>logInfoJson['http_host'],
|
|
551
|
+
"method" => logInfoJson['method'],
|
|
552
|
+
"url"=>logInfoJson['url'],
|
|
553
|
+
"status" => logInfoJson['status'].to_i,
|
|
554
|
+
"http_referer" => logInfoJson['http_referer'],
|
|
555
|
+
"body_bytes_sent" =>logInfoJson['body_bytes_sent'],
|
|
556
|
+
"request_time" => logInfoJson['request_time'],
|
|
557
|
+
"total_bytes_sent" => logInfoJson['total_bytes_sent'],
|
|
558
|
+
"server_ip" => logInfoJson['server_ip'],
|
|
559
|
+
}
|
|
560
|
+
data = {
|
|
561
|
+
'#ip' => logInfoJson['client_ip'],#Can be null
|
|
562
|
+
'#time' => time, #Cannot be null
|
|
563
|
+
'#account_id'=>account_id, # account_id and distinct_id cannot both be null
|
|
564
|
+
'#event_name'=>url, #If type is track can use, if no #event_name no upload
|
|
565
|
+
'#type' =>'track', #Can get from file, if in file, confirm whether upload data is user property or event property
|
|
566
|
+
'properties' => properties
|
|
567
|
+
}
|
|
568
|
+
event.set('message',data.to_json)
|
|
569
|
+
return [event]
|
|
570
|
+
|
|
571
|
+
end
|
|
572
|
+
```
|
|
573
|
+
|
|
574
|
+
##### 4.2.4 Other Logs
|
|
575
|
+
|
|
576
|
+
ta_output.conf configuration as follows
|
|
577
|
+
|
|
578
|
+
```
|
|
579
|
+
input {
|
|
580
|
+
beats {
|
|
581
|
+
port => "5044"
|
|
582
|
+
}
|
|
583
|
+
}
|
|
584
|
+
filter {
|
|
585
|
+
if "other" in [tags]{
|
|
586
|
+
#Can also do other filter data processing
|
|
587
|
+
ruby {
|
|
588
|
+
path => "/home/conf/outher.rb"
|
|
589
|
+
}
|
|
590
|
+
}
|
|
591
|
+
}
|
|
592
|
+
# Use thinkingdata as output
|
|
593
|
+
output{
|
|
594
|
+
thinkingdata {
|
|
595
|
+
url => "url"
|
|
596
|
+
appid =>"appid"
|
|
597
|
+
}
|
|
598
|
+
}
|
|
599
|
+
```
|
|
600
|
+
|
|
601
|
+
/home/conf/outher.rb script as follows:
|
|
602
|
+
|
|
603
|
+
```
|
|
604
|
+
# def register(params)
|
|
605
|
+
# # Here through params get parameters passed through script_params in logstash file
|
|
606
|
+
# #@message = params["xx"]
|
|
607
|
+
# end
|
|
608
|
+
def filter(event)
|
|
609
|
+
#Here process business data, if no grok and other processing, directly get metadata in message for processing
|
|
610
|
+
begin
|
|
611
|
+
_message = event.get('message') #message is your uploaded each log
|
|
612
|
+
#Here processed log similar to following data
|
|
613
|
+
#2020-06-01 22:20:11.222,123455,123.123.123.123,login,nihaoaaaaa,400
|
|
614
|
+
time,account_id,ip,event_name,msg,intdata=_message.split(/,/)
|
|
615
|
+
#Or through regex match data, or json data, ruby syntax parse json, can process data here for data upload
|
|
616
|
+
#mess = /regex/.match(_message)
|
|
617
|
+
#time = mess[1]
|
|
618
|
+
#level = mess[2]
|
|
619
|
+
#thread = mess[3]
|
|
620
|
+
#class_name_all = mess[4]
|
|
621
|
+
#event_name = mess[5]
|
|
622
|
+
#account_id = mess[6]
|
|
623
|
+
#api = mess[7]
|
|
624
|
+
|
|
625
|
+
properties = {
|
|
626
|
+
'msg' => msg,
|
|
627
|
+
'int_data' => intdata.to_i #to_i is int type, to_f is float type, to_s is string type (default)
|
|
628
|
+
}
|
|
629
|
+
data = {
|
|
630
|
+
'#time' => time,
|
|
631
|
+
'#account_id'=>account_id,
|
|
632
|
+
'#event_name'=>event_name,
|
|
633
|
+
'#ip' => ip,
|
|
634
|
+
'#type' =>'track',
|
|
635
|
+
'properties' => properties
|
|
636
|
+
}
|
|
637
|
+
event.set('message',data.to_json)
|
|
638
|
+
|
|
639
|
+
return [event]
|
|
640
|
+
rescue
|
|
641
|
+
#If do not want certain data to pass or error, this data can return empty, such as account_id or distinct_id both null directly return []
|
|
642
|
+
return []
|
|
643
|
+
end
|
|
644
|
+
end
|
|
645
|
+
```
|