Sending logs from a specific folder
- Using fluentd enables logs to transfer to the Hive log collecting server by reading the log from a local JSON file as shown picture below.
Example
- Example for the log in local JSON file
1234567891011121314151617181920212223242526272829{"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"} - How to stack logs in the log file
Configuring td–agent.conf as shown below, you can implement stacking logs in the log file.1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374<source>@type tailpath /game/sample/log/com2us.logpos_file /var/log/td-agent/com2us_filelog.postag ha2union.game.sample.com2us_logformat json</source><source>@type tailpath /game/sample/log/com2usHoldings.logpos_file /var/log/td-agent/com2usHoldings_filelog.postag ha2union.game.sample.com2usHoldings_logformat json</source><source>@type tailpath /game/sample/log/com2usPlatform.logpos_file /var/log/td-agent/com2usPlatform_filelog.postag ha2union.game.sample.com2usPlatform_logformat json</source><match ha2union.** >@type copy@include td-agent-forest.conf # fluentd-plugin-forest<store>@type forwardsend_timeout 60srecover_wait 10sheartbeat_interval 1s#heartbeat_type tcptransport tcpphi_threshold 16hard_timeout 60srequire_ack_response true # at-least-oncebuffer_type filebuffer_chunk_limit 8m # Allowable the maximum size of the chunkbuffer_queue_limit 10240 # Maximum length of output queuebuffer_path /data/log/td-agent/buffer/forward.bufferflush_interval 1s # Standby interval before calling the next buffer<server>name hiveanalyticslog-server-03host analytics-hivelog-03.withhive.comport 24224weight 50</server><server>name hiveanalyticslog-server-04host analytics-hivelog-04.withhive.comport 24224weight 50</server><secondary>@type filepath /var/log/td-agent/forward-failed # Changeable by each environment</secondary></store></match><source>@type forward</source> - secondary : Backup option. You can use secondary when it is unavailable to use the server because an error occurs, and back up the logs to path as a file format.
- Buffer Plugin : Buffer is a set of chunks. Chunks are flushed to the output queue periodically and transferred to the designated target. The following image shows the operating sequence.