@thinkingai/ae-cli 6.0.60 → 6.0.62
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 +6 -1
- package/README.zh.md +8 -1
- package/bin/runtime-capabilities.json +1 -1
- package/dist/{ai-monitor-FCXSLHAP.js → ai-monitor-X5GL44JT.js} +10 -9
- package/dist/ai-monitor.js +14 -13
- package/dist/{auth-ATK2SLEV.js → auth-SPQ46XQ3.js} +18 -10
- package/dist/{automation-FLCPFMN4.js → automation-7XC3VBZI.js} +87 -12
- package/dist/{capability-6KTSOI7L.js → capability-JZP4KXZC.js} +10 -9
- package/dist/{chunk-OAWPT7VP.js → chunk-2I5SZ5DS.js} +2 -2
- package/dist/{chunk-VRMGHQKE.js → chunk-2VKMHNUU.js} +11 -11
- package/dist/{chunk-2ETRY2CU.js → chunk-6HOM2FOJ.js} +19 -9
- package/dist/{chunk-KTJXD27G.js → chunk-AAN6KBUK.js} +3 -3
- package/dist/{chunk-4PSTYEG5.js → chunk-AMURHMS3.js} +11 -7
- package/dist/{chunk-6M7ZEDT2.js → chunk-BQFLABJQ.js} +11 -7
- package/dist/{chunk-BEYLCUZX.js → chunk-E457FREE.js} +3 -3
- package/dist/{chunk-CF6JTT2U.js → chunk-EFGUBGA6.js} +1 -1
- package/dist/{chunk-5M5LBRR3.js → chunk-ETQXIZFP.js} +15 -8
- package/dist/{chunk-72NJKS7O.js → chunk-F36ORPI6.js} +7 -32
- package/dist/{chunk-5E7MTTFN.js → chunk-F7TCQPQX.js} +23 -9
- package/dist/{chunk-AXTO4FTM.js → chunk-FGGEF7MI.js} +3 -3
- package/dist/{chunk-JEUXDY3B.js → chunk-HQED4YB4.js} +1 -1
- package/dist/{chunk-2F64AZYH.js → chunk-KA5WKR5P.js} +2 -2
- package/dist/{chunk-P7QDCWJ6.js → chunk-LFJ7N36I.js} +5 -1
- package/dist/chunk-N2MAYIRU.js +32 -0
- package/dist/chunk-NNK3JBH4.js +60 -0
- package/dist/{chunk-HTZ2MLYA.js → chunk-PLNS5J33.js} +11 -5
- package/dist/{chunk-HSZAIPUX.js → chunk-PRCHMOWT.js} +7 -5
- package/dist/chunk-PUSFEC6B.js +29 -0
- package/dist/{chunk-Z3Q2AEIN.js → chunk-R2SVAO4G.js} +14 -2
- package/dist/{chunk-SDKW6LYE.js → chunk-RYY5NJK3.js} +3 -3
- package/dist/{chunk-QVRIDN42.js → chunk-UCMO4LKL.js} +2 -2
- package/dist/{chunk-VJUXKVRE.js → chunk-VR2D54AA.js} +2 -2
- package/dist/{chunk-HVMCPKOZ.js → chunk-YIG3L4RC.js} +1 -1
- package/dist/{chunk-LOR4IA26.js → chunk-YJYC5PLL.js} +166 -188
- package/dist/{chunk-F2VFZUGG.js → chunk-ZVUXAHEV.js} +2 -2
- package/dist/{community-report-client-TJVCLZ3K.js → community-report-client-ULRNXLQV.js} +1 -1
- package/dist/{compat-check-XD2U7PZ2.js → compat-check-JD5D77ET.js} +5 -4
- package/dist/{config-U3GDWU6E.js → config-IIMRATTP.js} +7 -6
- package/dist/{context-YAQG6YQC.js → context-BXHIPIIX.js} +8 -6
- package/dist/{data-integration-QE37EQ3A.js → data-integration-VRJQ3HVK.js} +7 -6
- package/dist/{evaluation-2JSF4V47.js → evaluation-Q3AIGFOG.js} +5 -5
- package/dist/index.js +49 -43
- package/dist/{local-data-upload-client-KCMG6J62.js → local-data-upload-client-YTWMAAGE.js} +1 -1
- package/dist/{memory-WEB27VI6.js → memory-B44LY27L.js} +6 -7
- package/dist/{metadata-7FYE4234.js → metadata-ZVPG2MIA.js} +10 -9
- package/dist/{model-T7H7Q6BG.js → model-ANZBYVST.js} +4 -5
- package/dist/{personal-semantic-preference-O6VXM74A.js → personal-semantic-preference-YNCV4QG3.js} +45 -14
- package/dist/{project-semantic-2GGFJWW6.js → project-semantic-E7ZAQL5S.js} +9 -8
- package/dist/{sync-ULBB7WO5.js → sync-Y4OZRQAY.js} +9 -9
- package/dist/{te-agent-6RMF7LUV.js → te-agent-RKAUTYJZ.js} +303 -17
- package/dist/{te-analysis-HSYC7GNV.js → te-analysis-7N5VC4JB.js} +25 -20
- package/dist/{te-community-FLKZGQKB.js → te-community-SIA2UHTS.js} +13 -11
- package/dist/{te-dataops-OQQGTCUA.js → te-dataops-5MJQCODU.js} +13 -11
- package/dist/{te-engage-RIEBHL5T.js → te-engage-ZTLOMKO3.js} +73 -20
- package/dist/{te-kb-4HG2FMHJ.js → te-kb-LDL3MF2Y.js} +107 -25
- package/dist/{te-system-AL4B4XZL.js → te-system-473I5O53.js} +6 -7
- package/dist/{te-team-5O4UVUWE.js → te-team-JOWHCMZA.js} +92 -10
- package/dist/{things-TSJ64GBT.js → things-DOQ2L3O2.js} +9 -8
- package/dist/{update-Q5LURAWV.js → update-KUS6TCPB.js} +8 -6
- package/dist/{workspace-FF2HXJGR.js → workspace-MJFPIV7C.js} +6 -7
- package/package.json +6 -3
- package/skills/ae-agent/SKILL.md +19 -5
- package/skills/ae-agent/references/a2a.md +103 -0
- package/skills/ae-agent/references/command_index.md +11 -0
- package/skills/ae-analysis/SKILL.md +35 -23
- package/skills/ae-analysis/references/analysis_data_retrieval.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_export.md +1 -1
- package/skills/ae-analysis/references/asset_authentication_update.md +6 -2
- package/skills/ae-analysis/references/bad_case_review.md +4 -4
- package/skills/ae-analysis/references/command_index.md +7 -7
- package/skills/ae-analysis/references/governance_recommendation_export.md +2 -2
- package/skills/ae-analysis/references/personal_semantic_preference_add.md +9 -1
- package/skills/ae-analysis/references/personal_semantic_preference_delete.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_get.md +2 -0
- package/skills/ae-analysis/references/personal_semantic_preference_list.md +10 -2
- package/skills/ae-analysis/references/personal_semantic_preference_update.md +8 -0
- package/skills/ae-analysis/references/project_owner_update.md +5 -1
- package/skills/ae-analysis/references/scenario_evaluation.md +17 -1
- package/skills/ae-analysis/references/scenario_list.md +5 -6
- package/skills/ae-automation/SKILL.md +6 -2
- package/skills/ae-automation/references/cli.md +9 -3
- package/skills/ae-capability/SKILL.md +8 -4
- package/skills/ae-engage/SKILL.md +6 -1
- package/skills/ae-engage/references/common-metric.md +47 -1
- package/skills/ae-engage/references/flow-metric-update.md +1 -1
- package/skills/ae-engage/references/task-metric-update.md +1 -1
- package/skills/ae-kb/SKILL.md +11 -7
- package/skills/ae-kb/references/publication.md +45 -0
- package/skills/ae-kb/references/query-workflow.md +5 -1
- package/skills/ae-team/SKILL.md +7 -3
- package/skills/ae-team/references/copy-to-personal.md +7 -0
- package/skills/ae-team/references/promote.md +7 -0
- package/skills/ae-team/references/update.md +3 -3
- package/dist/chunk-Y74WTIKJ.js +0 -10
- package/skills/ae-tracking-matrix/SKILL.md +0 -170
- 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 +0 -12
- package/skills/ae-tracking-matrix/references/ae-capabilities.md +0 -93
- package/skills/ae-tracking-matrix/references/business-semantic-checks.md +0 -30
- package/skills/ae-tracking-matrix/references/categories/acquaintance_social_tracking_plan_template.md +0 -256
- package/skills/ae-tracking-matrix/references/categories/blockchain_game_tracking_plan_template.md +0 -213
- package/skills/ae-tracking-matrix/references/categories/card_game_tracking_plan_template.md +0 -407
- package/skills/ae-tracking-matrix/references/categories/casual_game_tracking_plan_template.md +0 -218
- package/skills/ae-tracking-matrix/references/categories/casual_music.md +0 -112
- package/skills/ae-tracking-matrix/references/categories/chess_cards_tracking_plan_template.md +0 -301
- package/skills/ae-tracking-matrix/references/categories/ecommerce_tracking_plan_template.md +0 -356
- package/skills/ae-tracking-matrix/references/categories/fishing.md +0 -775
- package/skills/ae-tracking-matrix/references/categories/game_basic_module_tracking_plan.md +0 -89
- package/skills/ae-tracking-matrix/references/categories/idle_card.md +0 -27
- package/skills/ae-tracking-matrix/references/categories/idle_game_tracking_plan_template.md +0 -415
- package/skills/ae-tracking-matrix/references/categories/interactive_video.md +0 -133
- package/skills/ae-tracking-matrix/references/categories/merge.md +0 -639
- package/skills/ae-tracking-matrix/references/categories/mmo_mobile_tracking_plan_template.md +0 -406
- package/skills/ae-tracking-matrix/references/categories/mmo_web.md +0 -230
- package/skills/ae-tracking-matrix/references/categories/music.md +0 -137
- package/skills/ae-tracking-matrix/references/categories/online_education_tracking_plan_template.md +0 -414
- package/skills/ae-tracking-matrix/references/categories/qipai_mj.md +0 -199
- package/skills/ae-tracking-matrix/references/categories/reading_tracking_plan_template.md +0 -158
- package/skills/ae-tracking-matrix/references/categories/roguelike_tracking_plan_template.md +0 -546
- package/skills/ae-tracking-matrix/references/categories/rpg.md +0 -195
- package/skills/ae-tracking-matrix/references/categories/short_drama_tracking_plan_template.md +0 -115
- package/skills/ae-tracking-matrix/references/categories/simulation_business_tracking_plan_template.md +0 -151
- package/skills/ae-tracking-matrix/references/categories/slg_tracking_plan_template.md +0 -260
- package/skills/ae-tracking-matrix/references/categories/slots_tracking_plan_template.md +0 -232
- package/skills/ae-tracking-matrix/references/categories/stranger_social_tracking_plan_template.md +0 -359
- package/skills/ae-tracking-matrix/references/categories/tower_defense.md +0 -365
- package/skills/ae-tracking-matrix/references/categories/video_editor_tracking_plan_template.md +0 -211
- package/skills/ae-tracking-matrix/references/categories/wechat_minigame.md +0 -132
- package/skills/ae-tracking-matrix/references/category-registry.md +0 -77
- package/skills/ae-tracking-matrix/references/data-verification/diagnosis_kb.md +0 -230
- package/skills/ae-tracking-matrix/references/data-verification/sql_checks.md +0 -406
- package/skills/ae-tracking-matrix/references/data-verification/tracking_plan_comparison.md +0 -128
- package/skills/ae-tracking-matrix/references/eval-cases.md +0 -74
- package/skills/ae-tracking-matrix/references/naming-dict.md +0 -238
- package/skills/ae-tracking-matrix/references/optimization-checklist.md +0 -85
- package/skills/ae-tracking-matrix/references/plan-generation/export-schema.md +0 -142
- package/skills/ae-tracking-matrix/references/plan-generation/module-baseline.md +0 -47
- package/skills/ae-tracking-matrix/references/plan-generation/reference.md +0 -794
- package/skills/ae-tracking-matrix/references/plan-generation/template-catalog.md +0 -94
- package/skills/ae-tracking-matrix/references/scene-routing.md +0 -80
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/android.md +0 -3787
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/c.md +0 -827
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-lua.md +0 -655
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocos2d-x.md +0 -953
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/cocoscreator.md +0 -1128
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/corona.md +0 -714
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/egret.md +0 -1268
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/flutter.md +0 -776
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/h5-and-app-sdk-integration.md +0 -182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/ios.md +0 -2755
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/javascript.md +0 -1182
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/layaair.md +0 -1300
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/macos.md +0 -1369
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/mini-program-mini-game.md +0 -1692
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/openharmony.md +0 -902
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/react-native.md +0 -763
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/uni-app.md +0 -1107
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unity.md +0 -1532
- package/skills/ae-tracking-matrix/references/sdk/client-sdk/unreal.md +0 -845
- package/skills/ae-tracking-matrix/references/sdk/faq/android_sdk_faq.md +0 -228
- package/skills/ae-tracking-matrix/references/sdk/faq/ios_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/java_sdk_faq.md +0 -407
- package/skills/ae-tracking-matrix/references/sdk/faq/javascript_sdk_faq.md +0 -163
- package/skills/ae-tracking-matrix/references/sdk/faq/minigame_sdk_faq.md +0 -149
- package/skills/ae-tracking-matrix/references/sdk/faq/miniprogram_sdk_faq.md +0 -153
- package/skills/ae-tracking-matrix/references/sdk/faq/python_sdk_faq.md +0 -232
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_log_guide.md +0 -314
- package/skills/ae-tracking-matrix/references/sdk/faq/sdk_usage_notes.md +0 -117
- package/skills/ae-tracking-matrix/references/sdk/faq/unity_sdk_faq.md +0 -148
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/filebeat-logstash-guide.md +0 -645
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_guide.md +0 -307
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/logbus2_parser_plugin.md +0 -347
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/restful_api_notes.md +0 -72
- package/skills/ae-tracking-matrix/references/sdk/integration-tools/ta-datax-writer-guide.md +0 -264
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/c.md +0 -566
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/erlang.md +0 -409
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/golang.md +0 -446
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/java.md +0 -557
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/lua.md +0 -457
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/nodejs.md +0 -490
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/php.md +0 -523
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/python.md +0 -484
- package/skills/ae-tracking-matrix/references/sdk/server-sdk/ruby.md +0 -442
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/data-rules.md +0 -391
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/first-event-validation.md +0 -91
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/preset-properties-system-fields.md +0 -635
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/updatable-events.md +0 -113
- package/skills/ae-tracking-matrix/references/sdk/te-data-rules/user-identification-rules.md +0 -466
- package/skills/ae-tracking-matrix/references/standard-base/README.md +0 -22
- package/skills/ae-tracking-matrix/references/standard-base/basic_event_data.md +0 -174
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties.md +0 -20
- package/skills/ae-tracking-matrix/references/standard-base/common_event_properties_setup.md +0 -7
- package/skills/ae-tracking-matrix/references/standard-base/data_type_design_principles.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/gameplay_event_data.md +0 -370
- package/skills/ae-tracking-matrix/references/standard-base/id_system_faq.md +0 -47
- package/skills/ae-tracking-matrix/references/standard-base/integration_must_know.md +0 -37
- package/skills/ae-tracking-matrix/references/standard-base/multi_platform_integration_notes.md +0 -27
- package/skills/ae-tracking-matrix/references/standard-base/multi_user_id_system_recommendations.md +0 -23
- package/skills/ae-tracking-matrix/references/standard-base/tracking_notes.md +0 -14
- package/skills/ae-tracking-matrix/references/standard-base/user_data.md +0 -46
- package/skills/ae-tracking-matrix/references/standard-base/user_id_system.md +0 -13
- package/skills/ae-tracking-matrix/references/system-fields.md +0 -297
- package/skills/ae-tracking-matrix/references/te-field-translations.md +0 -1791
- package/skills/ae-tracking-matrix/references/workflows/data-verification.md +0 -232
- package/skills/ae-tracking-matrix/references/workflows/feasibility-analysis.md +0 -829
- package/skills/ae-tracking-matrix/references/workflows/integration-qna.md +0 -355
- package/skills/ae-tracking-matrix/references/workflows/plan-generation.md +0 -283
- package/skills/ae-tracking-matrix/references/workflows/plan-lint.md +0 -168
- package/skills/ae-tracking-matrix/references/workflows/plan-review-optimize.md +0 -205
- package/skills/ae-tracking-matrix/references/workflows/prd-to-suggestions.md +0 -75
- package/skills/ae-tracking-matrix/references/workflows/troubleshooting.md +0 -36
- package/skills/ae-tracking-matrix/references/workflows/validated-upload.md +0 -107
- package/skills/ae-tracking-matrix/scripts/build_template_catalog.py +0 -114
- package/skills/ae-tracking-matrix/scripts/export_tracking_plan.py +0 -53
- package/skills/ae-tracking-matrix/scripts/finalize_plan.py +0 -166
- package/skills/ae-tracking-matrix/scripts/lint_tracking_plan.py +0 -674
- package/skills/ae-tracking-matrix/scripts/plan_contract.py +0 -200
- package/skills/ae-tracking-matrix/scripts/plan_types.py +0 -60
- package/skills/ae-tracking-matrix/scripts/prepare_delivery.py +0 -169
- package/skills/ae-tracking-matrix/scripts/sync_plan.py +0 -296
- package/skills/ae-tracking-matrix/scripts/upload_plan.py +0 -340
|
@@ -1,307 +0,0 @@
|
|
|
1
|
-
# LogBus2 Usage Recommendations
|
|
2
|
-
|
|
3
|
-
## 1. Introduction
|
|
4
|
-
|
|
5
|
-
LogBus2 is a log synchronization tool redeveloped by ThinkingData using Go language based on the original LogBus. Compared to LogBus1, it has the following advantages:
|
|
6
|
-
|
|
7
|
-
- **Lower memory usage**: Reduced to one-fifth of the original (about 100-200M)
|
|
8
|
-
- **Faster transmission speed**: Increased to 30,000-50,000 records/second
|
|
9
|
-
- **More stable operation**: LogBus1 has difficulty repairing file buffer areas in some special scenarios
|
|
10
|
-
- **Simpler deployment**: No JDK environment required, runs directly
|
|
11
|
-
|
|
12
|
-
## 2. Preparation Before Use
|
|
13
|
-
|
|
14
|
-
1. **Data format conversion**: Convert the data to be transmitted into TE data format, supporting TA format and Sensors format
|
|
15
|
-
2. **Determine data source**: Determine the file storage directory or Kafka address and topic
|
|
16
|
-
3. **Disk space**: Compared to LogBus1, LogBus2 removes the local disk queue, resulting in smaller disk usage
|
|
17
|
-
|
|
18
|
-
## 3. Application Scenarios
|
|
19
|
-
|
|
20
|
-
- Users using ThinkingData server SDK LogConsumer mode
|
|
21
|
-
- Scenarios with high requirements for data accuracy and dimensions
|
|
22
|
-
- Need to transmit large amounts of historical data
|
|
23
|
-
- Scenarios requiring data distribution to multiple projects
|
|
24
|
-
- Scenarios requiring integration with Sensors data
|
|
25
|
-
|
|
26
|
-
## 4. Performance Metrics
|
|
27
|
-
|
|
28
|
-
| Metric | Description |
|
|
29
|
-
| ------------------ | -------------------------------------------- |
|
|
30
|
-
| Transmission speed | 30,000-50,000 records/second (single LogBus) |
|
|
31
|
-
| Memory usage | About 100-200M |
|
|
32
|
-
| CPU limit | Supports cpu_limit configuration |
|
|
33
|
-
| Bandwidth usage | Peak about 70Mbps |
|
|
34
|
-
|
|
35
|
-
> Transmission efficiency is affected by network conditions, disk IO, system allocated resources, number of monitored files, etc.
|
|
36
|
-
|
|
37
|
-
## 5. Supported Environments
|
|
38
|
-
|
|
39
|
-
| Operating System | Architecture | Description |
|
|
40
|
-
| ---------------- | ------------ | ------------------------ |
|
|
41
|
-
| Linux | amd64 | Recommended |
|
|
42
|
-
| Linux | arm64 | Supported |
|
|
43
|
-
| Windows | amd64 | Supported |
|
|
44
|
-
| macOS | amd64 | Supported |
|
|
45
|
-
| Docker | - | Host machine persistence |
|
|
46
|
-
| K8S | - | Supports Helm deployment |
|
|
47
|
-
|
|
48
|
-
Download link: [Official Website Download](https://docs.thinkingdata.cn/ta-manual/latest/installation/installation_menu/data_import/logbus2_installation.html)
|
|
49
|
-
|
|
50
|
-
## 6. Configuration Guide
|
|
51
|
-
|
|
52
|
-
### File Data Source Configuration
|
|
53
|
-
|
|
54
|
-
```json
|
|
55
|
-
{
|
|
56
|
-
"push_url": "http://RECEIVER_URL",
|
|
57
|
-
"cpu_limit": 4,
|
|
58
|
-
"datasource": [
|
|
59
|
-
{
|
|
60
|
-
"type": "file",
|
|
61
|
-
"file_patterns": ["/data/log/*.log"],
|
|
62
|
-
"app_id": "your_app_id",
|
|
63
|
-
"http_compress": "gzip",
|
|
64
|
-
"unit_remove": "day",
|
|
65
|
-
"offset_remove": 7
|
|
66
|
-
}
|
|
67
|
-
]
|
|
68
|
-
}
|
|
69
|
-
```
|
|
70
|
-
|
|
71
|
-
### Kafka Data Source Configuration
|
|
72
|
-
|
|
73
|
-
```json
|
|
74
|
-
{
|
|
75
|
-
"datasource": [
|
|
76
|
-
{
|
|
77
|
-
"type": "kafka",
|
|
78
|
-
"topic": "topic1,topic2",
|
|
79
|
-
"consumer_group": "consumer_group_name",
|
|
80
|
-
"brokers": ["localhost:9092"],
|
|
81
|
-
"auto_commit": false,
|
|
82
|
-
"app_id": "your_app_id"
|
|
83
|
-
}
|
|
84
|
-
],
|
|
85
|
-
"push_url": "http://RECEIVER_URL"
|
|
86
|
-
}
|
|
87
|
-
```
|
|
88
|
-
|
|
89
|
-
### Multi-project Data Distribution Configuration
|
|
90
|
-
|
|
91
|
-
```json
|
|
92
|
-
{
|
|
93
|
-
"datasource": [
|
|
94
|
-
{
|
|
95
|
-
"file_patterns": ["/data/log/*.log"],
|
|
96
|
-
"app_id": "default_app_id",
|
|
97
|
-
"app_pipe": {
|
|
98
|
-
"attribute": "#lib_version",
|
|
99
|
-
"id_map": {
|
|
100
|
-
"app_id_1": "1.0.0",
|
|
101
|
-
"app_id_2": "2.0.0"
|
|
102
|
-
},
|
|
103
|
-
"default": "app_id_1"
|
|
104
|
-
}
|
|
105
|
-
}
|
|
106
|
-
],
|
|
107
|
-
"push_url": "http://RECEIVER_URL"
|
|
108
|
-
}
|
|
109
|
-
```
|
|
110
|
-
|
|
111
|
-
### Alert Configuration
|
|
112
|
-
|
|
113
|
-
```json
|
|
114
|
-
{
|
|
115
|
-
"alert": {
|
|
116
|
-
"enabled": true,
|
|
117
|
-
"receiver": "feishu_robot",
|
|
118
|
-
"extra": "logbus_instance_1",
|
|
119
|
-
"out_cfg": {
|
|
120
|
-
"feishu_robot_hook": "https://open.feishu.cn/open-apis/bot/v2/hook/xxx"
|
|
121
|
-
}
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
```
|
|
125
|
-
|
|
126
|
-
## 7. Common Operation Commands
|
|
127
|
-
|
|
128
|
-
### Environment Check
|
|
129
|
-
|
|
130
|
-
```bash
|
|
131
|
-
./logbus env
|
|
132
|
-
```
|
|
133
|
-
|
|
134
|
-
### Start Service
|
|
135
|
-
|
|
136
|
-
```bash
|
|
137
|
-
./logbus start
|
|
138
|
-
```
|
|
139
|
-
|
|
140
|
-
### Stop Service
|
|
141
|
-
|
|
142
|
-
```bash
|
|
143
|
-
./logbus stop
|
|
144
|
-
```
|
|
145
|
-
|
|
146
|
-
### View Sync Progress
|
|
147
|
-
|
|
148
|
-
```bash
|
|
149
|
-
./logbus progress
|
|
150
|
-
```
|
|
151
|
-
|
|
152
|
-
### Upgrade Version
|
|
153
|
-
|
|
154
|
-
```bash
|
|
155
|
-
./logbus stop
|
|
156
|
-
./logbus update
|
|
157
|
-
./logbus start
|
|
158
|
-
```
|
|
159
|
-
|
|
160
|
-
### View Transmission Speed
|
|
161
|
-
|
|
162
|
-
Check `logbus/log/transporter.log` to confirm transmission efficiency.
|
|
163
|
-
|
|
164
|
-
## 8. Configuration Parameter Details
|
|
165
|
-
|
|
166
|
-
### Global Configuration
|
|
167
|
-
|
|
168
|
-
| Parameter | Type | Default | Description |
|
|
169
|
-
| -------------------- | ------ | ------- | ----------------------------------------------- |
|
|
170
|
-
| push_url | string | - | Receiver address, required |
|
|
171
|
-
| cpu_limit | int | - | CPU core limit |
|
|
172
|
-
| ignore_app_id_verify | bool | false | Whether to skip appid and push_url verification |
|
|
173
|
-
|
|
174
|
-
### Data Report Configuration
|
|
175
|
-
|
|
176
|
-
| Parameter | Type | Default | Description |
|
|
177
|
-
| ---------------- | ------ | ------- | -------------------------------------------------------- |
|
|
178
|
-
| batch | int | 1000 | Data sending count condition, minimum 10, maximum 100000 |
|
|
179
|
-
| interval_seconds | int | 2 | Data sending time interval, maximum 60 seconds |
|
|
180
|
-
| send_thread_num | int | 3 | Data report thread count |
|
|
181
|
-
| http_timeout | string | 30s | HTTP request timeout time |
|
|
182
|
-
| http_compress | string | - | HTTP compression protocol, supports gzip/snappy |
|
|
183
|
-
|
|
184
|
-
### File Data Source Configuration
|
|
185
|
-
|
|
186
|
-
| Parameter | Type | Default | Description |
|
|
187
|
-
| --------------------- | -------- | ------- | ------------------------------------ |
|
|
188
|
-
| file_patterns | []string | - | File glob matching pattern, required |
|
|
189
|
-
| traverse_dir_interval | string | 30s | Directory scanning interval time |
|
|
190
|
-
|
|
191
|
-
### Kafka Data Source Configuration
|
|
192
|
-
|
|
193
|
-
| Parameter | Type | Default | Description |
|
|
194
|
-
| -------------- | -------- | ------- | --------------------------------------------------------------- |
|
|
195
|
-
| topic | string | - | Kafka topic, supports multiple topics (comma separated) |
|
|
196
|
-
| brokers | []string | - | Kafka broker address |
|
|
197
|
-
| consumer_group | string | - | Consumer group |
|
|
198
|
-
| auto_commit | bool | false | Whether to auto commit |
|
|
199
|
-
| protocol | string | none | Authentication protocol: plain/scramsha256/scramsha512/iam/none |
|
|
200
|
-
| fetch_count | int | 1000 | Number of data pulled at once |
|
|
201
|
-
|
|
202
|
-
### File Deletion Configuration
|
|
203
|
-
|
|
204
|
-
| Parameter | Type | Default | Description |
|
|
205
|
-
| ------------- | ------ | ------- | ----------------------------------------------------------------------------- |
|
|
206
|
-
| offset_remove | int | - | Deletion cycle |
|
|
207
|
-
| unit_remove | string | d | Deletion unit: d(day)/h(hour) |
|
|
208
|
-
| RemoveDirs | bool | false | Whether to delete folders, not recommended, may cause server write exceptions |
|
|
209
|
-
|
|
210
|
-
## 9. Important Notes
|
|
211
|
-
|
|
212
|
-
### File Operations Related
|
|
213
|
-
|
|
214
|
-
> **Do not rename files monitored by LogBus**, otherwise it will cause data loss or data duplication.
|
|
215
|
-
|
|
216
|
-
### Monitored File Requirements
|
|
217
|
-
|
|
218
|
-
- Files under LogBus monitoring path must be pure data files
|
|
219
|
-
- Cannot have files with gz/.iso/.rpm/.zip/.bz/.rar/.bz2 suffixes
|
|
220
|
-
- LogBus-v2 will bypass these files by default
|
|
221
|
-
|
|
222
|
-
### Multi-instance Running
|
|
223
|
-
|
|
224
|
-
- Multiple LogBus instances can run, but multiple LogBus cannot monitor files in the same path to report to the same project
|
|
225
|
-
|
|
226
|
-
### Kafka Consumption Optimization
|
|
227
|
-
|
|
228
|
-
- Consumer thread count should be equal to partition count
|
|
229
|
-
- Avoid single LogBus consuming partitions with consistent hash modulo results
|
|
230
|
-
- Can increase partition count and LogBus consumer count to speed up consumption
|
|
231
|
-
|
|
232
|
-
### Data Re-upload Notes
|
|
233
|
-
|
|
234
|
-
- For historical data, recommend enabling historical channel
|
|
235
|
-
- Pay attention to whether Kafka cluster has data backlog
|
|
236
|
-
- Re-uploading data should be sent to a separate topic to avoid confusion with formal data
|
|
237
|
-
|
|
238
|
-
## 10. Common Questions
|
|
239
|
-
|
|
240
|
-
### How to confirm network connectivity?
|
|
241
|
-
|
|
242
|
-
```bash
|
|
243
|
-
curl data_receiver_address/health-check
|
|
244
|
-
```
|
|
245
|
-
|
|
246
|
-
### How to confirm APPID is correct?
|
|
247
|
-
|
|
248
|
-
```bash
|
|
249
|
-
curl "data_receiver_address/check_appid?appid=target_APPID"
|
|
250
|
-
```
|
|
251
|
-
|
|
252
|
-
Return `{"code":0}` means normal.
|
|
253
|
-
|
|
254
|
-
### Reasons for data duplication?
|
|
255
|
-
|
|
256
|
-
1. Whether renamed already synced files
|
|
257
|
-
2. Whether source data files have duplicated data
|
|
258
|
-
3. Whether reset operation was executed
|
|
259
|
-
|
|
260
|
-
### What to do if transmission is slow?
|
|
261
|
-
|
|
262
|
-
1. Increase `send_thread_num` sending thread count
|
|
263
|
-
2. Enable HTTP compression: `http_compress: "gzip"`
|
|
264
|
-
3. Check network latency, bandwidth, recommend LogBus and Receiver in same internal network
|
|
265
|
-
4. Check if CPU, memory are limited
|
|
266
|
-
|
|
267
|
-
### What to do if Kafka consumption is slow?
|
|
268
|
-
|
|
269
|
-
1. Add LogBus instances
|
|
270
|
-
2. Increase `send_thread_num` for single LogBus
|
|
271
|
-
3. Increase partition count
|
|
272
|
-
4. Best strategy: LogBus consumer thread count = partition count
|
|
273
|
-
|
|
274
|
-
### Reporting delay caused by reading strategy differences?
|
|
275
|
-
|
|
276
|
-
If server-side data has multiple processes simultaneously writing data to different files, old versions of logbus2 will have serial reading, causing some real-time written files not to be reported in real-time. New version has handled this scenario.
|
|
277
|
-
|
|
278
|
-
```bash
|
|
279
|
-
# Stop LogBus
|
|
280
|
-
./logbus stop
|
|
281
|
-
|
|
282
|
-
# Upgrade LogBus
|
|
283
|
-
./logbus update
|
|
284
|
-
|
|
285
|
-
# Restart LogBus
|
|
286
|
-
./logbus start
|
|
287
|
-
```
|
|
288
|
-
|
|
289
|
-
## 11. Best Practice Recommendations
|
|
290
|
-
|
|
291
|
-
### Deployment Recommendations
|
|
292
|
-
|
|
293
|
-
1. **Resource planning**: Configure CPU and memory reasonably according to data volume
|
|
294
|
-
2. **Network optimization**: Deploy LogBus and Receiver in same internal network
|
|
295
|
-
3. **Monitoring alerting**: Configure alert notification to discover anomalies in time
|
|
296
|
-
|
|
297
|
-
### Configuration Recommendations
|
|
298
|
-
|
|
299
|
-
1. **Compression transmission**: Recommend enabling gzip compression to reduce network transmission volume
|
|
300
|
-
2. **File cleanup**: Configure auto deletion strategy to avoid insufficient disk space
|
|
301
|
-
3. **Thread configuration**: Adjust sending thread count according to data volume
|
|
302
|
-
|
|
303
|
-
### Operation Recommendations
|
|
304
|
-
|
|
305
|
-
1. **Version upgrade**: Regularly check release notes, upgrade in time
|
|
306
|
-
2. **Log retention**: Reasonably configure log retention time
|
|
307
|
-
3. **Process monitoring**: Monitor LogBus process
|
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
# LogBus2 Data Parser Plugin
|
|
2
|
-
|
|
3
|
-
> Logbus2 supports customer custom data parser from version 2.1.0.0, used for custom format conversion when original data format is inconsistent with TE data format. Functionality is comparable to Logbus1's Custom Interceptor feature.
|
|
4
|
-
|
|
5
|
-
## 1. Preparation
|
|
6
|
-
|
|
7
|
-
### Data Format
|
|
8
|
-
|
|
9
|
-
1. gRPC plugin server receives data for batch processing, multiple data records are concatenated using Logbus2 configuration parameter parser.separator (default ::)
|
|
10
|
-
2. Single data record is concatenated with file name or Kafka topic name, using configuration parameter parser.index_separator (default |ta|)
|
|
11
|
-
|
|
12
|
-
Example:
|
|
13
|
-
|
|
14
|
-
```python
|
|
15
|
-
# File name: event.log
|
|
16
|
-
# Original data 2 records:
|
|
17
|
-
{"user_id": "abc", "distinct_id": "123"}
|
|
18
|
-
{"user_id": "def", "distinct_id": "456"}
|
|
19
|
-
|
|
20
|
-
# Data received by gRPC plugin server:
|
|
21
|
-
event.log|ta|{"user_id": "abc", "distinct_id": "123"} ::event.log|ta|{"user_id": "def", "distinct_id": "456"}
|
|
22
|
-
```
|
|
23
|
-
|
|
24
|
-
gRPC plugin server return data format, concatenated using parser.separator to convert to standard ta format data:
|
|
25
|
-
|
|
26
|
-
```python
|
|
27
|
-
# Return data should be:
|
|
28
|
-
{"#account_id": "abc", "#distinct_id": "123"}::{\"#account_id\": \"def\", \"distinct_id\": \"456\"}
|
|
29
|
-
```
|
|
30
|
-
|
|
31
|
-
Error handling:
|
|
32
|
-
|
|
33
|
-
- Returning non-correct json data, main program will skip error lines
|
|
34
|
-
- Returning non-standard ta data, data report will produce errors
|
|
35
|
-
- Returning second parameter as error, will perform infinite retry to prevent error data entering te cluster. Can combine with alert function to predict error information in advance.
|
|
36
|
-
|
|
37
|
-
### proto File
|
|
38
|
-
|
|
39
|
-
parser.proto file is used to generate gRPC server code in various languages.
|
|
40
|
-
|
|
41
|
-
### Java
|
|
42
|
-
|
|
43
|
-
1. JDK 8+ (Logbus deployment environment and development environment should be consistent), Maven
|
|
44
|
-
2. Download protobuf compiler: https://github.com/protocolbuffers/protobuf/releases
|
|
45
|
-
3. Download grpc-java compiler: https://repo.maven.apache.org/maven2/io/grpc/protoc-gen-grpc-java/
|
|
46
|
-
|
|
47
|
-
Compilation steps:
|
|
48
|
-
|
|
49
|
-
```shell
|
|
50
|
-
# Generate ParserGrpc.java file
|
|
51
|
-
protoc --plugin=protoc-gen-grpc-java=protoc-gen-grpc-java-1.51.0-osx-aarch_64.exe --grpc-java_out=/ta/path/ -I=/ta/path/ /ta/path/parser.proto
|
|
52
|
-
|
|
53
|
-
# Generate ParserOuterClass.java file
|
|
54
|
-
protoc --experimental_allow_proto3_optional -I /ta/path/ --java_out=/ta/path/ /ta/path/parser.proto
|
|
55
|
-
```
|
|
56
|
-
|
|
57
|
-
### Python
|
|
58
|
-
|
|
59
|
-
1. Python3.6+
|
|
60
|
-
2. Install third-party libraries:
|
|
61
|
-
|
|
62
|
-
```shell
|
|
63
|
-
pip3 install grpcio-tools==1.48.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
|
64
|
-
pip3 install grpcio-health-checking==1.48.2 -i https://pypi.tuna.tsinghua.edu.cn/simple
|
|
65
|
-
```
|
|
66
|
-
|
|
67
|
-
Compilation steps:
|
|
68
|
-
|
|
69
|
-
```shell
|
|
70
|
-
python -m grpc_tools.protoc -I /ta/path/ --python_out=/ta/path/ --grpc_python_out=/ta/path/ /ta/path/parser.proto
|
|
71
|
-
```
|
|
72
|
-
|
|
73
|
-
## 2. gRPC Server Development
|
|
74
|
-
|
|
75
|
-
### Java Version (Required version JDK 8+)
|
|
76
|
-
|
|
77
|
-
Maven dependencies:
|
|
78
|
-
|
|
79
|
-
```xml
|
|
80
|
-
<dependencies>
|
|
81
|
-
<dependency>
|
|
82
|
-
<groupId>com.google.protobuf</groupId>
|
|
83
|
-
<artifactId>protobuf-java</artifactId>
|
|
84
|
-
<version>3.19.4</version>
|
|
85
|
-
</dependency>
|
|
86
|
-
<dependency>
|
|
87
|
-
<groupId>io.grpc</groupId>
|
|
88
|
-
<artifactId>grpc-all</artifactId>
|
|
89
|
-
<version>1.51.0</version>
|
|
90
|
-
</dependency>
|
|
91
|
-
</dependencies>
|
|
92
|
-
```
|
|
93
|
-
|
|
94
|
-
Parser logic demo:
|
|
95
|
-
|
|
96
|
-
```java
|
|
97
|
-
package org.interceptor.logbus2.service;
|
|
98
|
-
|
|
99
|
-
import org.interceptor.logbus2.proto.ParserGrpc;
|
|
100
|
-
import org.interceptor.logbus2.proto.ParserOuterClass;
|
|
101
|
-
import com.google.protobuf.ByteString;
|
|
102
|
-
import io.grpc.Server;
|
|
103
|
-
import io.grpc.ServerBuilder;
|
|
104
|
-
import io.grpc.stub.StreamObserver;
|
|
105
|
-
import java.util.*;
|
|
106
|
-
|
|
107
|
-
public class Demo extends ParserGrpc.ParserImplBase {
|
|
108
|
-
|
|
109
|
-
// Corresponds to logbus2 parameter parser.separator, custom separator between multiple data records, default ::
|
|
110
|
-
private static final String separator = ":ta:";
|
|
111
|
-
|
|
112
|
-
// Corresponds to logbus2 parameter parser.index_separator, separator between index and data for single data record, default |ta|
|
|
113
|
-
private static final String indexSeparator = "\\|ta\\|";
|
|
114
|
-
|
|
115
|
-
// Corresponds to logbus2 parameter parser.batch_separator, separator for converting one data to multiple data, default 0x01
|
|
116
|
-
private static final String batchSeparator = new String(new byte[]{0x01}, StandardCharsets.UTF_8);
|
|
117
|
-
|
|
118
|
-
public static String parseData(final String rawData) {
|
|
119
|
-
try {
|
|
120
|
-
// Processing logic: convert "test" character in received data to "product", and increase data to 3 records
|
|
121
|
-
String parseData = JSON.toJSONString(JSON.parseObject(rawData.replaceAll("test", "product"), TaDataDo.class));
|
|
122
|
-
return parseData + batchSeparator + parseData + batchSeparator + parseData;
|
|
123
|
-
} catch (Exception e) {
|
|
124
|
-
e.printStackTrace();
|
|
125
|
-
return null;
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
|
-
|
|
129
|
-
@Override
|
|
130
|
-
public void parse(ParserOuterClass.Request request, StreamObserver<ParserOuterClass.Response> responseObserver) {
|
|
131
|
-
String content = request.getContent().toStringUtf8();
|
|
132
|
-
String[] datas = content.split(separator);
|
|
133
|
-
List<String> responseList = new ArrayList<>();
|
|
134
|
-
|
|
135
|
-
for (String data : datas) {
|
|
136
|
-
try {
|
|
137
|
-
String[] split = data.split(indexSeparator);
|
|
138
|
-
responseList.add(parseData(split[1]));
|
|
139
|
-
} catch (Exception e) {
|
|
140
|
-
responseList.add("{}");
|
|
141
|
-
e.printStackTrace();
|
|
142
|
-
}
|
|
143
|
-
}
|
|
144
|
-
String join = String.join(separator, responseList);
|
|
145
|
-
|
|
146
|
-
ParserOuterClass.Response response = ParserOuterClass.Response.newBuilder().setContent(ByteString.copyFrom(join.getBytes())).build();
|
|
147
|
-
responseObserver.onNext(response);
|
|
148
|
-
responseObserver.onCompleted();
|
|
149
|
-
}
|
|
150
|
-
|
|
151
|
-
public static void main(String[] args) throws InterruptedException {
|
|
152
|
-
int availablePort = RandomUtils.nextInt(10000, 12000);
|
|
153
|
-
Server server = null;
|
|
154
|
-
for (int i = availablePort; i < 60000; i++) {
|
|
155
|
-
try {
|
|
156
|
-
server = ServerBuilder.forPort(i)
|
|
157
|
-
.maxInboundMessageSize(100 * 1024 * 1024)
|
|
158
|
-
.addService(new Demo())
|
|
159
|
-
.build()
|
|
160
|
-
.start();
|
|
161
|
-
break;
|
|
162
|
-
} catch (IOException e) {
|
|
163
|
-
// Port unavailable, try the next one
|
|
164
|
-
}
|
|
165
|
-
}
|
|
166
|
-
assert server != null;
|
|
167
|
-
// Important: This output is for logbus to get, format cannot be changed
|
|
168
|
-
System.out.println("1|1|tcp|127.0.0.1:" + server.getPort() + "|grpc");
|
|
169
|
-
server.awaitTermination();
|
|
170
|
-
}
|
|
171
|
-
}
|
|
172
|
-
```
|
|
173
|
-
|
|
174
|
-
### Python Version
|
|
175
|
-
|
|
176
|
-
```python
|
|
177
|
-
import random
|
|
178
|
-
from concurrent import futures
|
|
179
|
-
import socket
|
|
180
|
-
import sys
|
|
181
|
-
import json
|
|
182
|
-
import grpc
|
|
183
|
-
import parser_pb2
|
|
184
|
-
import parser_pb2_grpc
|
|
185
|
-
from grpc_health.v1.health import HealthServicer
|
|
186
|
-
from grpc_health.v1 import health_pb2, health_pb2_grpc
|
|
187
|
-
|
|
188
|
-
separator = ":ta:"
|
|
189
|
-
index_separator = "|ta|"
|
|
190
|
-
|
|
191
|
-
class ParserServicer(parser_pb2_grpc.ParserServicer):
|
|
192
|
-
def Parse(self, request, context):
|
|
193
|
-
data = request.content
|
|
194
|
-
result = parser_pb2.Response()
|
|
195
|
-
data_list = data.decode('utf-8').split(separator)
|
|
196
|
-
return_data_list = []
|
|
197
|
-
for data in data_list:
|
|
198
|
-
try:
|
|
199
|
-
raw_data_list = data.replace('\r\n', '').split(index_separator)
|
|
200
|
-
parse_data = json.loads(raw_data_list[1])
|
|
201
|
-
new_parse_data = {}
|
|
202
|
-
new_parse_data["properties"] = parse_data.copy()
|
|
203
|
-
new_parse_data["#account_id"] = parse_data["ACCOUNTID"]
|
|
204
|
-
new_parse_data["#distinct_id"] = parse_data["OSTYPE"]
|
|
205
|
-
new_parse_data["#type"] = "track"
|
|
206
|
-
new_parse_data["#ip"] = parse_data["IP"]
|
|
207
|
-
new_parse_data["#uuid"] = parse_data["UID"]
|
|
208
|
-
new_parse_data["#time"] = parse_data["LOGTM"]
|
|
209
|
-
new_parse_data["#event_name"] = "event_" + str(parse_data["CODE"])
|
|
210
|
-
return_data_list.append(json.dumps(new_parse_data))
|
|
211
|
-
except Exception as ve:
|
|
212
|
-
return_data_list.append('{}')
|
|
213
|
-
result.content = separator.join(return_data_list).encode('utf-8')
|
|
214
|
-
return result
|
|
215
|
-
|
|
216
|
-
def serve():
|
|
217
|
-
health = HealthServicer()
|
|
218
|
-
health.set("plugin", health_pb2.HealthCheckResponse.ServingStatus.Value('SERVING'))
|
|
219
|
-
server = grpc.server(futures.ThreadPoolExecutor(max_workers=10), options=[
|
|
220
|
-
('grpc.max_send_message_length', 4 * 1024 * 1024),
|
|
221
|
-
('grpc.max_receive_message_length', 4 * 1024 * 1024),
|
|
222
|
-
])
|
|
223
|
-
parser_pb2_grpc.add_ParserServicer_to_server(ParserServicer(), server)
|
|
224
|
-
health_pb2_grpc.add_HealthServicer_to_server(health, server)
|
|
225
|
-
port = get_open_port_in_random_range()
|
|
226
|
-
server.add_insecure_port(f'127.0.0.1:{port}')
|
|
227
|
-
server.start()
|
|
228
|
-
try:
|
|
229
|
-
# Important: This output is for logbus to get, format cannot be changed
|
|
230
|
-
print(f'1|1|tcp|127.0.0.1:{port}|grpc')
|
|
231
|
-
sys.stdout.flush()
|
|
232
|
-
while True:
|
|
233
|
-
time.sleep(60*60*24)
|
|
234
|
-
except KeyboardInterrupt:
|
|
235
|
-
server.stop(0)
|
|
236
|
-
|
|
237
|
-
if __name__ == '__main__':
|
|
238
|
-
serve()
|
|
239
|
-
```
|
|
240
|
-
|
|
241
|
-
## 3. Local gRPC Debugging
|
|
242
|
-
|
|
243
|
-
Create local debugging gRPC client, start client to send message after server starts.
|
|
244
|
-
|
|
245
|
-
### Java Client
|
|
246
|
-
|
|
247
|
-
```java
|
|
248
|
-
public class ProtoClient {
|
|
249
|
-
private static final String indexSeparator = "|ta|";
|
|
250
|
-
|
|
251
|
-
public static void main(String[] args) {
|
|
252
|
-
String event = "{\"#type\":\"track\",\"#time\":\"2023-09-05 18:58:17.021\",\"#event_name\":\"test\",\"#account_id\":\"test\",\"properties\":{\"#lib\":\"tga_python_sdk\"}}";
|
|
253
|
-
|
|
254
|
-
ManagedChannel channel = ManagedChannelBuilder.forAddress("127.0.0.1", 12345)
|
|
255
|
-
.usePlaintext()
|
|
256
|
-
.build();
|
|
257
|
-
ParserGrpc.ParserBlockingStub stub = ParserGrpc.newBlockingStub(channel);
|
|
258
|
-
ParserOuterClass.Request request = ParserOuterClass.Request.newBuilder()
|
|
259
|
-
.setContent(ByteString.copyFrom(("ta.log"+ indexSeparator + event).getBytes()))
|
|
260
|
-
.build();
|
|
261
|
-
|
|
262
|
-
try {
|
|
263
|
-
ParserOuterClass.Response response = stub.parse(request);
|
|
264
|
-
System.out.println("Server Response: " + response.getContent().toStringUtf8());
|
|
265
|
-
} catch (Exception e) {
|
|
266
|
-
e.printStackTrace();
|
|
267
|
-
} finally {
|
|
268
|
-
channel.shutdown();
|
|
269
|
-
}
|
|
270
|
-
}
|
|
271
|
-
}
|
|
272
|
-
```
|
|
273
|
-
|
|
274
|
-
### Python Client
|
|
275
|
-
|
|
276
|
-
```python
|
|
277
|
-
import grpc
|
|
278
|
-
import parser_pb2
|
|
279
|
-
import parser_pb2_grpc
|
|
280
|
-
|
|
281
|
-
def send_grpc_request():
|
|
282
|
-
channel = grpc.insecure_channel('127.0.0.1:12345')
|
|
283
|
-
stub = parser_pb2_grpc.ParserStub(channel)
|
|
284
|
-
event = '{"#type":"track","#time":"2023-09-04 16:46:06.055","#event_name":"test","#distinct_id":"test"}'
|
|
285
|
-
request = parser_pb2.Request(content=f'1.log|ta|{event}'.encode('utf-8'))
|
|
286
|
-
response = stub.Parse(request)
|
|
287
|
-
print("Response received:", response.content)
|
|
288
|
-
|
|
289
|
-
if __name__ == '__main__':
|
|
290
|
-
send_grpc_request()
|
|
291
|
-
```
|
|
292
|
-
|
|
293
|
-
## 4. Configuration
|
|
294
|
-
|
|
295
|
-
### Logbus2 Configuration File
|
|
296
|
-
|
|
297
|
-
```json
|
|
298
|
-
{
|
|
299
|
-
"datasource": [
|
|
300
|
-
{
|
|
301
|
-
"file_patterns": ["/path/server_log/*log"],
|
|
302
|
-
"app_id": "debug-appid",
|
|
303
|
-
"parser": {
|
|
304
|
-
"cmd": "java -jar /path/lib/xxx.jar",
|
|
305
|
-
"depend_sh": "true",
|
|
306
|
-
"separator": ":ta:",
|
|
307
|
-
"hand_shake": {
|
|
308
|
-
"protocol_version": 1,
|
|
309
|
-
"magic_cookie_key": "LogBus",
|
|
310
|
-
"magic_cookie_value": "v2"
|
|
311
|
-
}
|
|
312
|
-
}
|
|
313
|
-
}
|
|
314
|
-
],
|
|
315
|
-
"push_url": "http://push_url"
|
|
316
|
-
}
|
|
317
|
-
```
|
|
318
|
-
|
|
319
|
-
> Note: Comments should be removed before starting
|
|
320
|
-
|
|
321
|
-
## 5. FAQ
|
|
322
|
-
|
|
323
|
-
1. **Startup error: Unrecongnized remote plugin message......latest protocol**
|
|
324
|
-
|
|
325
|
-
Cause: Program uses proto generated files not latest, Logbus client verification failed
|
|
326
|
-
|
|
327
|
-
Solution: Refer to preparation section, regenerate java classes or python files based on proto file
|
|
328
|
-
|
|
329
|
-
2. **Log error: Parser return data is invalid: length is changed**
|
|
330
|
-
|
|
331
|
-
Cause: Current version Logbus2 parser plugin verifies whether data count before and after parsing is same, if different will cause verification failure
|
|
332
|
-
|
|
333
|
-
Solution: Confirm whether data count before and after parsing is same, if one-to-many function is needed, use parser.batch_separator for data concatenation
|
|
334
|
-
|
|
335
|
-
3. **Logbus log error: rpc error: code = Canceled desc = stream terminated by RST_STREAM with error code: CANCEL**
|
|
336
|
-
|
|
337
|
-
Also Java program error: io.grpc.StatusRuntimeException: RESOURCE_EXHAUSTED: gRPC message exceeds maximum size
|
|
338
|
-
|
|
339
|
-
Cause: Parser program set transmission data byte size too small, causing logbus and Java parser program RPC communication transmission failure
|
|
340
|
-
|
|
341
|
-
Solution: Increase maximum transmission byte size in program, Java setting: maxInboundMessageSize(100*1024*1024)
|
|
342
|
-
|
|
343
|
-
4. **Startup error: plugin [parser] start failed: fork/exec /bin/sh: bad file descriptor**
|
|
344
|
-
|
|
345
|
-
Cause: Due to plugin compiler compatibility issue, cannot run in mac environment currently
|
|
346
|
-
|
|
347
|
-
Solution: Need to run in linux / windows environment
|