How to Send Data through Logstash or Kafka from Elastic APM | Elastic Blog
工程

如何从 Elastic APM 通过 Logstash 或 Kafka 发送数据

使寿/ VMSpot

6.4.0 APM Logstash Kafka使 Logstash使 Logstash APM

Elasticsearch

  1. Logstash Elasticsearch
  2. Elastic APM Logstash
  3. Elasticsearch
  4. Kafka

Logstash

Logstash Logstash beats/lumberjack APM Elasticsearch

input {
   beats {
        id => "apm-server"
        port => 5044
  }
}
output {
  elasticsearch {
    hosts => ["elasticsearch:9200"]
    index => "apm-%{[beat][version]}-%{[processor][event]}-%{+YYYY.MM.dd}"
  }
}

APM Logstash

Beat APM Beats FrameworkBeats Logstash APM Beat [@metadata][beat] == "apm-server" 使

APM

Logstash APM apm-server.yml

output.elasticsearch:
  enabled: false
output.logstash
  enabled: true
  hosts: ["logstash:5044"]

backoffproxy ssl Elastic APM

APM

xpack.monitoring.elasticsearch:
  enabled: true
  hosts: ["elasticsearch:9200"]

APM Elasticsearch

Elasticsearch

便 APM Elasticsearch APM UI APM Elastic

Elasticsearch APM

 apm-server setup --template

APM

apm-server export template > apm-6.4.2.tmpl.json

Elasticsearch 使 curl使

curl -XPUT -H 'Content-Type: application/json' http://elasticsearch:9200/_template/apm-6.4.2 -d @apm-6.4.2.tmpl.json

_template/apm-*

{
  "apm-6.4.2": {
    "order":1,
    "index_patterns": [
      "apm-6.4.2-*"
    ],
...

Logstash

1.使 Logstash APM 1. APM

使

APM

Javascript

APM Elasticsearch Elasticsearch Elasticsearch APM 使 rum.source_mapping.elasticsearch

apm-server:
  rum:
    source_mapping:
      elasticsearch:
        hosts: ["elasticsearch:9200"]
        index_pattern: "apm-*-sourcemap*"

APM apm-*-sourcemap*

Logstash Elasticsearch便 Elasticsearch Logstash

Kafka

Kafka APM Elasticsearch 使 Kafka APM

output.kafka:
  enabled: true
  hosts: ["kafka:9092"]
  topics:
    - default: 'apm'
      topic: 'apm-%{[context.service.name]}'

使

Kafka Logstash Elasticsearch

input {
  kafka {
    id => "apm-server-kafka"
    bootstrap_servers => ["kafka:9092"]
    topics_pattern => "apm.*"
    codec => "json"
  }
}
output {
  elasticsearch {
    hosts => ["elasticsearch:9200"]
    index => "apm-%{[beat][version]}-%{[processor][event]}-%{+YYYY.MM.dd}"
  }
}

APM Logstash Logstash Kafka

APM 使 Logstash Kafka APM