ローカルログとメトリクス
This getting started guide allows you collect local logs and metrics from your system, sending them to ClickStack for visualization and analysis.
この例はOSXおよびLinuxシステムでのみ動作します
The following example assumes you have started ClickStack using the instructions for the all-in-one image and connected to the local ClickHouse instance or a ClickHouse Cloud instance.
このサンプルデータセットは、HyperDX in ClickHouse Cloudでも使用できますが、フローにわずかな調整が必要です。 ClickHouse CloudでHyperDXを使用する場合、ユーザーはこの展開モデルのためのスタートガイドで説明されているように、ローカルでOpen Telemetryコレクタを実行する必要があります。
HyperDX UIに移動する
Visit http://localhost:8080 to access the HyperDX UI if deploying locally. If using HyperDX in ClickHouse Cloud, select your service and HyperDX
from the left menu.
取り込みAPIキーをコピーする
このステップは、ClickHouse CloudでHyperDXを使用している場合は必要ありません。
Navigate to Team Settings
and copy the Ingestion API Key
from the API Keys
section. This API key ensures data ingestion through the OpenTelemetry collector is secure.

ローカルOpenTelemetry構成を作成する
Create a otel-local-file-collector.yaml
file with the following content.
重要: 上記でコピーした取り込みAPIキーの値を<YOUR_INGESTION_API_KEY>
に設定してください (ClickHouse CloudでのHyperDXには必要ありません)。
この構成は、OSXおよびLinuxシステムのシステムログおよびメトリックを収集し、その結果をポート4317のOTLPエンドポイントを介してClickStackに送信します。
この構成は取り込み時にタイムスタンプを調整し、各イベントに更新された時間値を割り当てます。ユーザーは、正確なイベント時刻が保持されるように、OTelプロセッサやオペレーターを使用してログファイル内のタイムスタンプを前処理または解析することが理想的です。
この例のセットアップでは、受信者またはファイルプロセッサがファイルの先頭から開始するように構成されている場合、すべての既存のログエントリには同じ調整されたタイムスタンプが割り当てられます - それはオリジナルのイベント時刻ではなく、処理の時間です。ファイルに追加された新しいイベントには、実際の生成時間に近いタイムスタンプが付与されます。
この動作を避けるには、受信者の構成で開始位置をend
に設定できます。これにより、新しいエントリのみが取り込まれ、真の到着時刻に近いタイムスタンプが付与されます。
For more details on the OpenTelemetry (OTel) configuration structure, we recommend the official guide.
OSXでより詳細なログを取得したいユーザーは、以下のコマンドを実行してコレクタを開始する前にlog stream --debug --style ndjson >> /tmp/all_events.log
を実行できます。これにより、詳細なオペレーティングシステムログが/tmp/all_events.log
ファイルにキャプチャされます。このファイルは、上記の構成ですでに含まれています。
コレクタを起動する
Run the following docker command to start an instance of the OTel collector.
すべてのシステムログにアクセスするためにコレクタをルートユーザーとして実行します - これはLinuxベースのシステムから保護されたパスのログをキャプチャするために必要です。ただし、このアプローチは本番環境では推奨されません。本番環境では、OpenTelemetryコレクタは、意図されたログソースにアクセスするために必要な最小限の権限でローカルエージェントとして展開されるべきです。
The collector will immediately begin collecting local system logs and metrics.
システムログを探索する
Navigate to the HyperDX UI. The search UI should be populated with local system logs. Expand the filters to select the system.log
:

システムメトリックを探索する
We can explore our metrics using charts.
Navigate to the Chart Explorer via the left menu. Select the source Metrics
and Maximum
as the aggregation type.
For the Select a Metric
menu simply type memory
before selecting system.memory.utilization (Gauge)
.
Press the run button to visualize your memory utilization over time.

Note the number is returned as a floating point %
. To render it more clearly, select Set number format
.

From the subsequent menu you can select Percentage
from the Output format
drop down before clicking Apply
.
