特定日志文件
從特定資料夾發送日誌¶
範例¶
- 本地 JSON 文件中的登錄示例
{
"dateTime": "2022-04-15 13:02:45",
"timezone": "GMT+09:00",
"channel": "C2S",
"source": "Web",
"serverId": "1",
"osVer": "4.3.1",
"appId": "com.gcp2.hivesdk.android.google.global.normal",
"company": "C2S",
"model": "SHW-M250S",
"lang": "ko",
"class": "sample value of class",
"os": "A",
"appVer": "1.0",
"cpu": "armeabi-v7a",
"market": "GO",
"clientIp": "127.0.0.1",
"guid": "4314nbh31211234ld",
"sdkVer": "2.0.1",
"serverIp": "127.0.0.2",
"category": "hive_login_log",
"newUser": "N",
"hiveSnsType": "FB",
"deviceName": "SM-G935",
"osVersionFixed": "9.2.1",
"serverUid": "QA-2",
"level": "7",
"isEmulator": "1"
}
- 如何在日誌文件中堆疊日誌
- 如下所示配置 td-agent.conf,您可以在日誌文件中實現堆疊日誌。
<source>
@type tail
path /game/sample/log/com2us.log
pos_file /var/log/td-agent/com2us_filelog.pos
tag ha2union.game.sample.com2us_log
format json
</source>
<source>
@type tail
path /game/sample/log/com2usHoldings.log
pos_file /var/log/td-agent/com2usHoldings_filelog.pos
tag ha2union.game.sample.com2usHoldings_log
format json
</source>
<source>
@type tail
path /game/sample/log/com2usPlatform.log
pos_file /var/log/td-agent/com2usPlatform_filelog.pos
tag ha2union.game.sample.com2usPlatform_log
format json
</source>
<match ha2union.** >
@type copy
@include td-agent-forest.conf # fluentd-plugin-forest
<store>
@type forward
send_timeout 60s
recover_wait 10s
heartbeat_interval 1s
#heartbeat_type tcp
transport tcp
phi_threshold 16
hard_timeout 60s
require_ack_response true # at-least-once
buffer_type file
buffer_chunk_limit 8m # 허용되는 최대 청크의 크기
buffer_queue_limit 10240 # 출력 큐의 최대길이
buffer_path /data/log/td-agent/buffer/forward.buffer
flush_interval 1s # 다음 버퍼를 호출하기 전에 대기하는 간격
<server>
name hiveanalyticslog-server-03
host analytics-hivelog-03.withhive.com
port 24224
weight 50
</server>
<server>
name hiveanalyticslog-server-04
host analytics-hivelog-04.withhive.com
port 24224
weight 50
</server>
<secondary>
@type file
path /var/log/td-agent/forward-failed # 각자 환경에 따라 변경
</secondary>
</store>
</match>
<source>
@type forward
</source>
-
secondary: 備用選項。當因錯誤而無法使用伺服器時,您可以使用**secondary**,並將日誌備份到**path**作為文件格式。
-
緩衝插件 : 緩衝是一組區塊。區塊會定期刷新到輸出隊列並轉移到指定目標。下圖顯示了操作序列。