Skip to content

Instantly share code, notes, and snippets.

@dlopes7
Created February 4, 2025 20:53
Show Gist options
  • Save dlopes7/e905636f1fa6e04f11f4962d3687c565 to your computer and use it in GitHub Desktop.
Save dlopes7/e905636f1fa6e04f11f4962d3687c565 to your computer and use it in GitHub Desktop.

Create a collector

Requirements

Step by step

  • Create a file called mainifest.yaml with contents
dist:
  name: otelcol-dev
  description: Basic OTel Collector distribution for Developers
  output_path: ./otelcol-dev

exporters:
  - gomod:
      go.opentelemetry.io/collector/exporter/debugexporter v0.119.0
  - gomod:
      go.opentelemetry.io/collector/exporter/otlphttpexporter v0.119.0

processors:
  - gomod:
      go.opentelemetry.io/collector/processor/batchprocessor v0.119.0

receivers:
  - gomod: 
      github.com/open-telemetry/opentelemetry-collector-contrib/receiver/netflowreceiver v0.119.0
  • install ocb
curl --proto '=https' --tlsv1.2 -fL -o ocb \
https://github.com/open-telemetry/opentelemetry-collector-releases/releases/download/cmd%2Fbuilder%2Fv0.119.0/ocb_0.119.0_linux_amd64
chmod +x ocb
  • build the collector
./ocb --config manifest.yaml
  • create the config.yaml file
receivers:
  netflow:
    hostname: "0.0.0.0"
    scheme: netflow
    port: 2055
    sockets: 16
    workers: 32

processors:
  batch:
    send_batch_size: 30 
    timeout: 30s

exporters:
  debug:
  otlphttp:
    endpoint: https://<environment>.live.dynatrace.com/api/v2/otlp
    headers: 
      Authorization: "Api-Token <dynatrace_ingest_logs_token>"

service:
  pipelines:
    logs:
      receivers: [netflow]
      processors: [batch]
      exporters: [debug, otlphttp]
  telemetry:
    logs:
      level: debug
  • run the collector
./otelcol-dev/otelcol-dev --config config.yaml
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment