Logstash TCP

Logstash TCP モニターには、この Splunk Observability Cloud インテグレーションを 使用してください。メリット、インストール、設定、メトリクスを参照してください

Splunk Distribution of OpenTelemetry Collector は、Smart Agent レシーバを logstash-tcp モニタータイプで使用して、Logstash Monitoring API を通じて Logstash デプロイの健全性とパフォーマンスを監視します。 server または client モードで動作する logstash tcp 出力プラグインからイベントを取得し、それらをデータポイントに変換します。

このインテグレーションは、イベントをメトリクスに変換する Logstash Metrics filterプラグインと組み合わせて使用することを意図しています。このモニターが client モードの場合にのみ、自動検出を使用できます。

このレシーバーはLinuxとWindowsで利用できます。

メリット

インテグレーションを設定すると、これらの機能にアクセスできるようになります:

インストール

このインテグレーションを導入するには、以下の手順に従ってください:

  1. Splunk Distribution of OpenTelemetry Collector をホストまたはコンテナプラットフォームにデプロイします:

  2. 設定のセクションで説明するように、モニターを設定します。

  3. Splunk Distribution of OpenTelemetry Collector を再起動します。

設定

Smart Agent モニターとCollector のインテグレーションを使用するには、以下の手順に従います:

  1. Smart Agent レシーバーを設定ファイルに含めます。

  2. レシーバーセクションおよびパイプラインセクションの両方で、Collector 構成にモニタータイプを追加します。

このインテグレーションを有効にするには、Collector構成に以下を追加します:

YAML
receivers:
  smartagent/logstash-tcp:
    type: logstash-tcp
    ... # Additional config

次に、設定ファイルの service.pipelines.metrics.receivers セクションにモニターを追加します:

YAML
service:
  pipelines:
    metrics:
      receivers: [smartagent/logstash-tcp]

例:Logstash Metricsプラグインの設定

次の例は、Logstash Metrics フィルター・プラグインから timermeter の両方のメトリクスを使用する方法を示しています:

YAML
input {
  file {
    path => "/var/log/auth.log"
    start_position => "beginning"
    tags => ["auth_log"]
  }

  # A contrived file that contains timing messages
  file {
    path => "/var/log/durations.log"
    tags => ["duration_log"]
    start_position => "beginning"
  }
}

filter {
  if "duration_log" in [tags] {
    dissect {
      mapping => {
        "message" => "Processing took %{duration} seconds"
      }
      convert_datatype => {
        "duration" => "float"
      }
    }
    if "_dissectfailure" not in [tags] { # Filter out bad events
      metrics {
        timer => { "process_time" => "%{duration}" }
        flush_interval => 10
        # This makes the timing stats pertain to only the previous 5 minutes
        # instead of since Logstash last started.
        clear_interval => 300
        add_field => {"type" => "processing"}
        add_tag => "metric"
      }
    }
  }
  # Count the number of logins using SSH from /var/log/auth.log
  if "auth_log" in [tags] and [message] =~ /sshd.*session opened/ {
    metrics {
      # This determines how often metric events will be sent to the agent, and
      # thus how often data points will be emitted.
      flush_interval => 10
      # The name of the meter will be used to construct the name of the metric
      # in Splunk Infrastructure Monitoring. For this example, a data point called `logins.count` would
      # be generated.
      meter => "logins"
      add_tag => "metric"
    }
  }
}

output {
  # This can be helpful to debug
  stdout { codec => rubydebug }

  if "metric" in [tags] {
    tcp {
      port => 8900
      # The agent will connect to Logstash
      mode => "server"
      # Needs to be "0.0.0.0" if running in a container.
      host => "127.0.0.1"
    }
  }
}

Logstashが上記のコンフィギュレーションで構成されると、logstash-tcp モニターは logins.countprocess_time.<timer_field> を収集します。

コンフィギュレーション設定

次の表に、このモニタータイプの設定オプションを示します:

オプション

必須

タイプ

説明

host

string

mode: server の場合、リッスンするローカル IP アドレス。条件

mode: client の場合は、接続するLogstashホスト/IP。

port

いいえ

integer

mode: server の場合、リッスンするローカルポート。条件

mode: client、Logstash TCP 出力プラグインのポート。ポートが 0 の場合、ランダムなリスニングポートがカーネルによって割り当てられます。(デフォルト:0

mode

いいえ

string

server または client として動作するかどうか。対応する

tcp 出力プラグインの対応する設定は、これと逆に設定する必要があります。(デフォルト:client

desiredTimerFields

いいえ

list of strings

(デフォルト:[mean, max, p99, count]

reconnectDelay

いいえ

integer

TCP接続ができないか、切断された後に

再接続するまでの待機時間。(デフォルト:5s

debugEvents

いいえ

bool

true の場合、Logstashから受信したイベントは、デシリアライズされた形式の

エージェントの標準出力にダンプされます(デフォルト: false

メトリクス

このインテグレーションで利用可能なメトリクスはありません。

トラブルシューティング

If you are a Splunk Observability Cloud customer and are not able to see your data in Splunk Observability Cloud, you can get help in the following ways.

Available to Splunk Observability Cloud customers

Available to prospective customers and free trial users

  • Ask a question and get answers through community support at Splunk Answers.

  • Join the Splunk community #observability Slack channel to communicate with customers, partners, and Splunk employees worldwide.