目录
此内容是否有帮助?

# LogBus Windows 版使用ガイド

このセクションでは、主にデータ転送ツール LogBus の Windows バージョンの使用方法について説明します

ドッキングを開始する前に、データルールTEのデータ形式とデータルールに精通した後、このガイドを読んでドッキングする必要があります。

LogBusアップロードするデータは、TEデータ形式に従う必要があります

# ダウンロード LogBusWindows 版

最新バージョン: 1.3.0

更新時間: 2021-10-19

ダウンロード (opens new window)

# LogBus の概要

LogBus ツールは、主にバックエンドのログデータを TE バックグラウンドにリアルタイムでインポートするために使用されます。そのコアは Flume に似ています。サーバーログディレクトリのテキストストリームを監視し、ディレクトリの下の任意のログテキストに新しいデータが生成されると、新しいデータを検証し、リアルタイムで TE バックグラウンドに送信します。

次のカテゴリのユーザーは、LogBus を使用してデータにアクセスすることをお勧めします。

  1. サービス側 SDK を使用するユーザーは、LogBus 経由でデータをアップロード
  2. データの正確性と次元に対する要求が高く、クライアント SDK だけではデータのニーズを満たすことができない、あるいはクライアント SDK へのアクセスが不便である
  3. バックエンドのデータプッシュプロセス
  4. 大量の履歴データ

# 使用前のデータ準備

1.まず転送するデータを ETL で TE のデータ形式、ローカルに書き込むか Kafka クラスタに転送する。サービス側 SDK のローカルテキストや Kafka の consumer を使うと、データはすでに正しい形式で、変換する必要はないです。

2.アップロードされたデータのテキストが保存されているディレクトリ、または Kafka のアドレスと topic を特定し、LogBus の関連構成を設定すると、LogBus はテキストディレクトリのテキスト変更(新規または既存のテキストを監視)を監視したり、Kafka のデータを購読したりします。

3.監視ディレクトリに保存され、アップロードされたデータログの名前を直接変更しないでください。名前変更ログは新しいテキストに相当し、LogBus はこれらのテキストを再アップロードしてデータが重複する可能性があります。

4.LogBus コンポーネントにデータバッファが含まれているため、LogBus ディレクトリがディスクに占める容量が少し大きくなる可能性があるため、LogBus インストールノードのディスク容量が十分で、プロジェクトへのデータ転送ごとに少なくとも 10G のストレージを確保する必要があります。

# LogBus のインストールとアップグレード

# 3.1 LogBus のインストール LogBus

  1. LogBus ツール (opens new window)をダウンロードし解凍します。
  2. 解凍後のディレクトリ構造:
  3. bin:起動プログラムフォルダ
  4. conf:テキストフォルダの設定
  5. lib:機能ブッククリップ

# LogBus のパラメータ構成

1.解凍後のconfディレクトリには、LogBusLogBus Templateのすべての LogBus 構成パラメーターを含む構成テキストが含まれています。

2.logBlogB を開い us.confて関連するパラメータ設定

# 4.1 プロジェクトとデータソースの構成(必須構成)

  • プロジェクト APP_ID

APP_ID は繰り返し設定できません

##APPID is from token on TGA website. Please get the APPID of the accessing project from the project configuration page in TA background and fill it in here. Multiple APPIDs are split by''.

APPID=APPID_1,APPID_2
  • ブック構成の監視(いずれかを選択してください。構成する必要があります)

# 4.1.1.データソースがローカルテキストの場合

The path and file name of the data file read by ##LogBus (file name supports ambiguous matching) requires read permission
##Different APPIDs are separated by commas, while different directories of the same APPID are separated by spaces
##TAIL_ FILE file name supports wildcard matching
TAIL_FILE=C:/path1/dir*/log.*,C:/path3/txt.*

TAIL_FILE マルチパスで複数のディレクトリを監視

対応するパラメータの設定:

APPID=APPID1,APPID2

TAIL_FILE=C:/root/log_dir1/dir_*/log.* C:/root/log_dir*/log*/log.*,C:/test_log/*

特定のルールは次のとおりです。

  • 同じ APP_ID の複数の監視パスをスペース分割
  • 異なる APP_ID の監視パスはカンマ","で分割され、カンマ分割後の監視パスは APP_ID に対応
  • 監視パス内のディレクトリはワイルドカードによる監視
  • テキストサポートワイルドカードによる監視
  • パス区切り文字は"/"または"\</code>"、""を利用しないでください。またはC:/root/_ log or C:\\ root\ _ log 監視が必要なログブックをサーバーのルートディレクトリに保存しないでください。

# 4.1.2.データソースが kafka の場合

パラメータKAFKA_TOPICS複数のトピックを監視する必要がある場合は、スペースを使用してトピックを区切ることができます。複数の APP_ID がある場合は、半角カンマを使用して各 APP_ID が監視するトピックを区切ります。パラメータKAFKA_GROUPIDは一意でなければなりません。パラメータKAFKA_OFFSET_RESET、Kafka のパラメータを設定します。デフォルトはearliest

注意:データソースの Kafka バージョンは 0.10.1.0 以上でなければなりません

単一 APP_ID サンプル:

APPID=appid1

######kafka configure
#KAFKA_GROUPID=tga.group
#KAFKA_SERVERS=localhost:9092
#KAFKA_TOPICS=topic1 topic2
#KAFKA_OFFSET_RESET=earliest

マルチ APP_ID サンプル:

APPID=appid1,appid2

######kafka configure
#KAFKA_GROUPID=tga.group
#KAFKA_SERVERS=localhost:9092
#KAFKA_TOPICS=topic1 topic2,topic3 topic4
#KAFKA_OFFSET_RESET=earliest

# 4.2 トランスポートパラメータ構成(必須構成)

##Transfer Settings
##URL transmitted by

##For HTTP transmission use the
PUSH_URL=http://receiver.ta.thinkingdata.cn/logbus
##If you are using a self-hosting deployment service, modify the transfer URL to: http://Data Acquisition Address/logbus

##Maximum number per transmission
#BATCH=10000
##How often should it be transmitted at least once (in seconds)
#INTERVAL_SECONDS=600
##Number of transfer threads, default single thread, recommended for use when network conditions are poor, multi-thread will consume more memory and CPU resources
#NUMTHREAD=1

##Compressed format for file transfer:gzip,snappy,none
#COMPRESS_FORMAT=none

# 4.3 コンバータ構成(オプション構成)

##Converter type temporary supportjson csv regex splitter
#PARSE_TYPE=json

##Additional Fixed Attributes in Format:name value,name1 value1
#LABELS=

##Attribute name and type for PARSE_ TYPE: CSV regex splitter, format:name type, name1 type 1
##Types of support are:float int string date list bool
#SCHEMA=

##Specify separator, PARSE_ TYPE cannot be empty when CSV splitter
#SPLITTER=

##Specify the separator for the list type. When a list type exists, it defaults to:
#LIST_SPLITTER=,

##Regular expression, PARSE_ TYPE cannot be empty when regex
#FORMAT_REGEX=

# 4.4 監視文書削除構成(オプション構成)

# Monitor directory file deletion and remove comments to start the delete file function
#can only be deleted by day or hour
# UNIT_ REMOVE=hour
#Delete how long ago
# OFFSET_ REMOVE=20
#Delete uploaded monitoring files every few minutes
# FREQUENCY_REMOVE=60

# 4.5 配置文書の例

##################################################################################
##    Thinkingdata Data Analysis Platform Transfer Tool LogBus Profile
##Non-comments are required parameters and comments are optional parameters which can be adapted to your own circumstances
##Proper configuration
##Environmental Requirements: java8+, see TGA website for more detailed requirements
##http://doc.thinkinggame.cn/tdamanual/installation/logbus_installation.html
##################################################################################

##APPID token from TGA website
##Different APPIDs are separated by commas and cannot be configured repeatedly
APPID=from_tga1,from_tga2

#-----------------------------------source----------------------------------------

######file-source
##The path and file name of the data file read by LogBus (file name supports ambiguous matching) requires read permission
##Different APPIDs are separated by commas, while different directories of the same APPID are separated by spaces
##TAIL_ FILE File Names Support Regular Expressions in the Java Standard
TAIL_FILE=C:/path1/log.* C:/path2/txt.*,C:/path3/log.* C:/path4/log.* C:/path5/txt.*

######kafka-source
#KAFKA_GROUPID=tga.flume
#KAFKA_SERVERS=
#KAFKA_TOPICS=
#KAFKA_OFFSET_RESET=earliest

#------------------------------------sink-----------------------------------------
##Transfer Settings
URL transmitted by ##
##If you are using a self-hosting deployment service, please modify the transfer URL to: http://Data Acquisition Address/logbus
##PUSH_URL=http://receiver.ta.thinkingdata.cn/logbus
PUSH_URL=http://${Data Acquisition Address}/logbus

##Maximum number per transmission
#BATCH=10000

##How often should it be transmitted at least once (in seconds)
#INTERVAL_SECONDS=60

##### http compress
##Compressed format for file transfer: gzip, snappy, none
#COMPRESS_FORMAT=none

##Do you add UUID attributes to each data
#IS_ADD_UUID=true

#------------------------------------parse----------------------------------------
##Converter type temporary support:json csv regex splitter
#PARSE_TYPE=json

##Additional Fixed Attributes in Format:name value,name1 value1
#LABELS=

##Attribute name and type for PARSE_ TYPE: CSV regex splitter in format:name type,name1 type1
##Types of support are:float int string date list bool
#SCHEMA=

##Specify separator, PARSE_ TYPE cannot be empty when CSV splitter
#SPLITTER=

##Specify the separator for the list type. When a list type exists, it defaults to:
#LIST_SPLITTER=,

##Regular expression, PARSE_ TYPE cannot be empty when regex
#FORMAT_REGEX=

#------------------------------------other----------------------------------------
##To start the delete file function, start the delete file program every hour by opening the note (you must open both fields below) to delete the file in the monitor directory.
##Delete files before offset by unit
##Delete how long ago
#OFFSET_ REMOVE=
##Only receive deletions by day or hour
#UNIT_REMOVE=

# LogBus の起動

最初に起動する前に以下のチェックを行ってください:

1.java バージョンを確認

binディレクトリには、2 つのスクリプトがあります:logbus.batcheck_java.bat

ここでcheck_javaは java バージョンが要求を満たしているかどうかを検出し、スクリプトを実行し、java バージョンが満たされていない場合Java version is less than 1.8またはCan't find java, please install jre first.などのヒントがあります。

JDK のバージョンを更新するか、次のセクションの内容を参照してください

2.LogBus のスタンドアロン JDK のインストール

LogBus デプロイノードの場合、環境上の関係で、JDK バージョンは LogBus の要件を満たしておらず、LogBus の JDK バージョンに置き換えることはできません。この機能を使用できます。

binディレクトリに入りますinstall_logbus_jdk.batがあります。

このスクリプトを実行すると、LogBus 作業ディレクトリに Java ディレクトリが追加されます。LogBus はデフォルトでこのディレクトリの下の JDK 環境を使用します。

3.logBus.conf の設定を完了し、パラメータ環境チェックコマンド

logBus.conf の設定については、「LogBus の設定」を参照してください

構成が完了したらenvコマンドを実行し、構成パラメーターが正しいかどうかをチェックします。

logbus.bat env

赤いエラー情報が出た場合、構成ブックに例外の提示がないまで再修正する必要があります。

logBus.conf の構成を変更した後、新しい構成を有効にするにはLogBusを再起動する必要

4.LogBus を起動

logbus.bat start

起動が完了すると、logkit.exe が開きます。閉じないでください。そうしないと、データが重複してアップロードしてください

# LogBus コマンドの詳細

# 6.1 ヘルプ情報

パラメータや--help-hがなければ、ヘルプ情報が表示されます

主な説明 LogBus のコマンド:

usage: logbus <Command | Auxiliary Command> [Option]
Command:
        start                                                        Start logBus.
        restart                                                      Restart logBus.
        stop                                                         Exit logBus safely.
        reset                                                        Reset logBus to read records
        stop_atOnce                                                  Force logBus exit.
Auxiliary Command:
        env                                                          Operating environment verification.
        server [-url <url>|-url <url> -appid <appid>]                Test Receiver Network.
        show_conf                                                    Display current logBus configuration information.
        version                                                      Display version number.
        update                                                       Update logbus to latest version.

Option:
 -appid <appid>   Project appid
 -h,--help        Display Help Document and Exit.
 -path <path>     Specify the absolute path to the test file
 -url <url>       Specify the URL address for the test
Instance:
   logbus.bat start                                                    Start logBus.
   logbus.bat stop                                                     Exit logBus safely.
   logbus.bat restart                                                  Restart logBus.
   logbus.bat server -url http://${Receiver Address}/logbus -appid *****      Test Receiver Network

# 6.2 トランスポートチャネル検査 server -url

フォーマットチェックを完了した後、データチャネルをチェックする必要があります。server-urlコマンドを使用してチェックできます。チェックと同時に、TE プラットフォームで受け取った APP_ID を入力できます。APP_ID とプロジェクトがバインドされていることに注意してください。入力する前に、入力した APP_ID がプロジェクトに対応していることを確認してください

 logbus.bat server -url http://${Receiver Address}/logbus -appid ${appid}

# 6.3 ショーケース構成情報 show_conf

show_confコマンドを使用して、次の図に示すように、LogBus の構成情報を表示できます

logbus.bat show_conf

# 6.4 起動環境チェック env

env起動環境のチェックをすることができます。出力された情報の後ろにアスタリスクがついている場合、構成に問題があることを示し、アスタリスクのヒントがなくなるまで修正する必要があります。

logbus.bat env

# 6.5 アップグレード LogBus バージョン update

updateを最新バージョンに更新できます

logbus.bat update

# 6.6 スタート start

フォーマットのチェック、データチャネルのチェック、環境チェックが完了すると、LogBus を起動してデータのアップロードを行います。LogBus は自動的にテキストに新しいデータが書き込まれているかどうかを検出し、新しいデータがある場合はデータをアップロードします。

logbus.bat start

# 6.7 ストップ stop

LogBus を停止する場合、stopコマンドを使用してください。

logbus.bat stop

# 6.8 ストップ stop_atOnce

すぐに LogBus を停止する場合は、stop_atOnceコマンドを使用してください。

logbus.bat stop_atOnce

# 6.9 再起動 restart

restartコマンドを使用して LogBus を再起動できます。

logbus.bat restart

# 6.10 リセット reset

resetがリセットされます。このコマンドを使用すると、テキスト転送レコードが空になり、LogBus はすべてのデータを再アップロードします。不明確な条件でコマンドを使用すると、データが重複する可能性があります。TA スタッフとコミュニケーションを取ってから使用することをお勧めします。

logbus.bat reset

リセットコマンドを使用した後、start を実行してデータ転送を再開します。

# 6.11 バージョン番号を見る version

使用している LogBus のバージョン番号を知りたい場合はversionコマンドを使用できます

logbus.bat version

# 7.ChangeLog

# バージョン 1.3.0 --- 2021/10/19

  • 非 TA フォーマットデータアップロード

# バージョン 1.2.0 --- 2021/05/26

  • cygWin モードをサポート

# バージョン 1.1.0 --- 2020/08/28

  • #UUID のサポート
  • 支持#イベントid 和#ファーストチェック_id
  • マルチスレッド送信のサポート
  • 区切り解析と正則解析

# バージョン 1.0.0 --- 2020/06/25

  • LogBus-Windows リリース