mirror of
https://github.com/openshift/openshift-docs.git
synced 2026-02-05 12:46:18 +01:00
OBSDOCS-2520: Modularize otel-collector-receivers.adoc
This commit is contained in:
committed by
openshift-cherrypick-robot
parent
c69b3a328e
commit
90b8785499
@@ -1,866 +1,45 @@
|
||||
:_mod-docs-content-type: ASSEMBLY
|
||||
[id="otel-collector-receivers"]
|
||||
[id="otel-collector-receivers_{context}"]
|
||||
= Receivers
|
||||
include::_attributes/common-attributes.adoc[]
|
||||
:context: otel-collector-receivers
|
||||
|
||||
toc::[]
|
||||
|
||||
Receivers get data into the Collector. A receiver can be push or pull based. Generally, a receiver accepts data in a specified format, translates it into the internal format, and passes it to processors and exporters defined in the applicable pipelines. By default, no receivers are configured. One or more receivers must be configured. Receivers may support one or more data sources.
|
||||
[role="_abstract"]
|
||||
Receivers get data into the Collector. A receiver can be push or pull based. Generally, a receiver accepts data in a specified format, translates it into the internal format, and passes it to processors and exporters defined in the applicable pipelines. By default, no receivers are configured. One or more receivers must be configured. Receivers support one or more data sources.
|
||||
|
||||
Currently, the following General Availability and Technology Preview receivers are available for the {OTELShortName}:
|
||||
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#otlp-receiver_otel-collector-receivers[OTLP Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#jaeger-receiver_otel-collector-receivers[Jaeger Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#hostmetrics-receiver_otel-collector-receivers[Host Metrics Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#k8sobjectsreceiver-receiver_otel-collector-receivers[Kubernetes Objects Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#kubeletstats-receiver_otel-collector-receivers[Kubelet Stats Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#prometheus-receiver_otel-collector-receivers[Prometheus Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#otlpjsonfile-receiver_otel-collector-receivers[OTLP JSON File Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#zipkin-receiver_otel-collector-receivers[Zipkin Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#kafka-receiver_otel-collector-receivers[Kafka Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#k8scluster-receiver_otel-collector-receivers[Kubernetes Cluster Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#opencensus-receiver_otel-collector-receivers[OpenCensus Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#filelog-receiver_otel-collector-receivers[Filelog Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#journald-receiver_otel-collector-receivers[Journald Receiver]
|
||||
- xref:../../../observability/otel/otel-collector/otel-collector-receivers.adoc#kubernetesevents-receiver_otel-collector-receivers[Kubernetes Events Receiver]
|
||||
include::modules/otel-receivers-otlp-receiver.adoc[leveloffset=+1]
|
||||
|
||||
[id="otlp-receiver_{context}"]
|
||||
== OTLP Receiver
|
||||
include::modules/otel-receivers-jaeger-receiver.adoc[leveloffset=+1]
|
||||
|
||||
The OTLP Receiver ingests traces, metrics, and logs by using the OpenTelemetry Protocol (OTLP).
|
||||
The OTLP Receiver ingests traces and metrics using the OpenTelemetry protocol (OTLP).
|
||||
include::modules/otel-receivers-hostmetrics-receiver.adoc[leveloffset=+1]
|
||||
|
||||
.OpenTelemetry Collector custom resource with an enabled OTLP Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
otlp:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:4317 # <1>
|
||||
tls: # <2>
|
||||
ca_file: ca.pem
|
||||
cert_file: cert.pem
|
||||
key_file: key.pem
|
||||
client_ca_file: client.pem # <3>
|
||||
reload_interval: 1h # <4>
|
||||
http:
|
||||
endpoint: 0.0.0.0:4318 # <5>
|
||||
tls: {} # <6>
|
||||
include::modules/otel-receivers-k8sobjectsreceiver-receiver.adoc[leveloffset=+1]
|
||||
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [otlp]
|
||||
metrics:
|
||||
receivers: [otlp]
|
||||
# ...
|
||||
----
|
||||
<1> The OTLP gRPC endpoint. If omitted, the default `+0.0.0.0:4317+` is used.
|
||||
<2> The server-side TLS configuration. Defines paths to TLS certificates. If omitted, the TLS is disabled.
|
||||
<3> The path to the TLS certificate at which the server verifies a client certificate. This sets the value of `ClientCAs` and `ClientAuth` to `RequireAndVerifyClientCert` in the `TLSConfig`. For more information, see the link:https://godoc.org/crypto/tls#Config[`Config` of the Golang TLS package].
|
||||
<4> Specifies the time interval at which the certificate is reloaded. If the value is not set, the certificate is never reloaded. The `reload_interval` field accepts a string containing valid units of time such as `ns`, `us` (or `µs`), `ms`, `s`, `m`, `h`.
|
||||
<5> The OTLP HTTP endpoint. The default value is `+0.0.0.0:4318+`.
|
||||
<6> The server-side TLS configuration. For more information, see the `grpc` protocol configuration section.
|
||||
include::modules/otel-receivers-kubeletstats-receiver.adoc[leveloffset=+1]
|
||||
|
||||
[id="jaeger-receiver_{context}"]
|
||||
== Jaeger Receiver
|
||||
include::modules/otel-receivers-prometheus-receiver.adoc[leveloffset=+1]
|
||||
|
||||
The Jaeger Receiver ingests traces in the Jaeger formats.
|
||||
include::modules/otel-receivers-otlpjsonfile-receiver.adoc[leveloffset=+1]
|
||||
|
||||
.OpenTelemetry Collector custom resource with an enabled Jaeger Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
jaeger:
|
||||
protocols:
|
||||
grpc:
|
||||
endpoint: 0.0.0.0:14250 # <1>
|
||||
thrift_http:
|
||||
endpoint: 0.0.0.0:14268 # <2>
|
||||
thrift_compact:
|
||||
endpoint: 0.0.0.0:6831 # <3>
|
||||
thrift_binary:
|
||||
endpoint: 0.0.0.0:6832 # <4>
|
||||
tls: {} # <5>
|
||||
include::modules/otel-receivers-zipkin-receiver.adoc[leveloffset=+1]
|
||||
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [jaeger]
|
||||
# ...
|
||||
----
|
||||
<1> The Jaeger gRPC endpoint. If omitted, the default `+0.0.0.0:14250+` is used.
|
||||
<2> The Jaeger Thrift HTTP endpoint. If omitted, the default `+0.0.0.0:14268+` is used.
|
||||
<3> The Jaeger Thrift Compact endpoint. If omitted, the default `+0.0.0.0:6831+` is used.
|
||||
<4> The Jaeger Thrift Binary endpoint. If omitted, the default `+0.0.0.0:6832+` is used.
|
||||
<5> The server-side TLS configuration. See the OTLP Receiver configuration section for more details.
|
||||
include::modules/otel-receivers-kafka-receiver.adoc[leveloffset=+1]
|
||||
|
||||
[id="hostmetrics-receiver_{context}"]
|
||||
== Host Metrics Receiver
|
||||
include::modules/otel-receivers-k8scluster-receiver.adoc[leveloffset=+1]
|
||||
|
||||
The Host Metrics Receiver ingests metrics in the OTLP format.
|
||||
include::modules/otel-receivers-opencensus-receiver.adoc[leveloffset=+1]
|
||||
|
||||
.OpenTelemetry Collector custom resource with an enabled Host Metrics Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: otel-hostfs-daemonset
|
||||
namespace: <namespace>
|
||||
# ...
|
||||
---
|
||||
apiVersion: security.openshift.io/v1
|
||||
kind: SecurityContextConstraints
|
||||
allowHostDirVolumePlugin: true
|
||||
allowHostIPC: false
|
||||
allowHostNetwork: false
|
||||
allowHostPID: true
|
||||
allowHostPorts: false
|
||||
allowPrivilegeEscalation: true
|
||||
allowPrivilegedContainer: true
|
||||
allowedCapabilities: null
|
||||
defaultAddCapabilities:
|
||||
- SYS_ADMIN
|
||||
fsGroup:
|
||||
type: RunAsAny
|
||||
groups: []
|
||||
metadata:
|
||||
name: otel-hostmetrics
|
||||
readOnlyRootFilesystem: true
|
||||
runAsUser:
|
||||
type: RunAsAny
|
||||
seLinuxContext:
|
||||
type: RunAsAny
|
||||
supplementalGroups:
|
||||
type: RunAsAny
|
||||
users:
|
||||
- system:serviceaccount:<namespace>:otel-hostfs-daemonset
|
||||
volumes:
|
||||
- configMap
|
||||
- emptyDir
|
||||
- hostPath
|
||||
- projected
|
||||
# ...
|
||||
---
|
||||
apiVersion: opentelemetry.io/v1beta1
|
||||
kind: OpenTelemetryCollector
|
||||
metadata:
|
||||
name: otel
|
||||
namespace: <namespace>
|
||||
spec:
|
||||
serviceAccount: otel-hostfs-daemonset
|
||||
mode: daemonset
|
||||
volumeMounts:
|
||||
- mountPath: /hostfs
|
||||
name: host
|
||||
readOnly: true
|
||||
volumes:
|
||||
- hostPath:
|
||||
path: /
|
||||
name: host
|
||||
config:
|
||||
receivers:
|
||||
hostmetrics:
|
||||
collection_interval: 10s # <1>
|
||||
initial_delay: 1s # <2>
|
||||
root_path: / # <3>
|
||||
scrapers: # <4>
|
||||
cpu: {}
|
||||
memory: {}
|
||||
disk: {}
|
||||
service:
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [hostmetrics]
|
||||
# ...
|
||||
----
|
||||
<1> Sets the time interval for host metrics collection. If omitted, the default value is `+1m+`.
|
||||
<2> Sets the initial time delay for host metrics collection. If omitted, the default value is `+1s+`.
|
||||
<3> Configures the `root_path` so that the Host Metrics Receiver knows where the root filesystem is. If running multiple instances of the Host Metrics Receiver, set the same `root_path` value for each instance.
|
||||
<4> Lists the enabled host metrics scrapers. Available scrapers are `cpu`, `disk`, `load`, `filesystem`, `memory`, `network`, `paging`, `processes`, and `process`.
|
||||
include::modules/otel-receivers-filelog-receiver.adoc[leveloffset=+1]
|
||||
|
||||
[id="k8sobjectsreceiver-receiver_{context}"]
|
||||
== Kubernetes Objects Receiver
|
||||
include::modules/otel-receivers-journald-receiver.adoc[leveloffset=+1]
|
||||
|
||||
The Kubernetes Objects Receiver pulls or watches objects to be collected from the Kubernetes API server.
|
||||
This receiver watches primarily Kubernetes events, but it can collect any type of Kubernetes objects.
|
||||
This receiver gathers telemetry for the cluster as a whole, so only one instance of this receiver suffices for collecting all the data.
|
||||
include::modules/otel-receivers-kubernetesevents-receiver.adoc[leveloffset=+1]
|
||||
|
||||
:FeatureName: The Kubernetes Objects Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenTelemetry Collector custom resource with an enabled Kubernetes Objects Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: otel-k8sobj
|
||||
namespace: <namespace>
|
||||
# ...
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: otel-k8sobj
|
||||
namespace: <namespace>
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
- pods
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- "events.k8s.io"
|
||||
resources:
|
||||
- events
|
||||
verbs:
|
||||
- watch
|
||||
- list
|
||||
# ...
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: otel-k8sobj
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: otel-k8sobj
|
||||
namespace: <namespace>
|
||||
roleRef:
|
||||
kind: ClusterRole
|
||||
name: otel-k8sobj
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
# ...
|
||||
---
|
||||
apiVersion: opentelemetry.io/v1beta1
|
||||
kind: OpenTelemetryCollector
|
||||
metadata:
|
||||
name: otel-k8s-obj
|
||||
namespace: <namespace>
|
||||
spec:
|
||||
serviceAccount: otel-k8sobj
|
||||
mode: deployment
|
||||
config:
|
||||
receivers:
|
||||
k8sobjects:
|
||||
auth_type: serviceAccount
|
||||
objects:
|
||||
- name: pods # <1>
|
||||
mode: pull # <2>
|
||||
interval: 30s # <3>
|
||||
label_selector: # <4>
|
||||
field_selector: # <5>
|
||||
namespaces: [<namespace>,...] # <6>
|
||||
- name: events
|
||||
mode: watch
|
||||
exporters:
|
||||
debug:
|
||||
service:
|
||||
pipelines:
|
||||
logs:
|
||||
receivers: [k8sobjects]
|
||||
exporters: [debug]
|
||||
# ...
|
||||
----
|
||||
<1> The Resource name that this receiver observes: for example, `pods`, `deployments`, or `events`.
|
||||
<2> The observation mode that this receiver uses: `pull` or `watch`.
|
||||
<3> Only applicable to the pull mode. The request interval for pulling an object. If omitted, the default value is `+1h+`.
|
||||
<4> The label selector to define targets.
|
||||
<5> The field selector to filter targets.
|
||||
<6> The list of namespaces to collect events from. If omitted, the default value is `+all+`.
|
||||
|
||||
[id="kubeletstats-receiver_{context}"]
|
||||
== Kubelet Stats Receiver
|
||||
|
||||
The Kubelet Stats Receiver extracts metrics related to nodes, pods, containers, and volumes from the kubelet's API server. These metrics are then channeled through the metrics-processing pipeline for additional analysis.
|
||||
|
||||
.OpenTelemetry Collector custom resource with an enabled Kubelet Stats Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
kubeletstats:
|
||||
collection_interval: 20s
|
||||
auth_type: "serviceAccount"
|
||||
endpoint: "https://${env:K8S_NODE_NAME}:10250"
|
||||
insecure_skip_verify: true
|
||||
service:
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [kubeletstats]
|
||||
env:
|
||||
- name: K8S_NODE_NAME # <1>
|
||||
valueFrom:
|
||||
fieldRef:
|
||||
fieldPath: spec.nodeName
|
||||
# ...
|
||||
----
|
||||
<1> Sets the `K8S_NODE_NAME` to authenticate to the API.
|
||||
|
||||
The Kubelet Stats Receiver requires additional permissions for the service account used for running the OpenTelemetry Collector.
|
||||
|
||||
.Permissions required by the service account
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: otel-collector
|
||||
rules:
|
||||
- apiGroups: ['']
|
||||
resources: ['nodes/stats']
|
||||
verbs: ['get', 'watch', 'list']
|
||||
- apiGroups: [""]
|
||||
resources: ["nodes/proxy"] # <1>
|
||||
verbs: ["get"]
|
||||
# ...
|
||||
----
|
||||
<1> The permissions required when using the `extra_metadata_labels` or `request_utilization` or `limit_utilization` metrics.
|
||||
|
||||
[id="prometheus-receiver_{context}"]
|
||||
== Prometheus Receiver
|
||||
|
||||
The Prometheus Receiver scrapes the metrics endpoints.
|
||||
|
||||
.OpenTelemetry Collector custom resource with an enabled Prometheus Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
prometheus:
|
||||
config:
|
||||
scrape_configs: # <1>
|
||||
- job_name: 'my-app' # <2>
|
||||
scrape_interval: 5s # <3>
|
||||
static_configs:
|
||||
- targets: ['my-app.example.svc.cluster.local:8888'] # <4>
|
||||
service:
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [prometheus]
|
||||
# ...
|
||||
----
|
||||
<1> Scrapes configurations using the Prometheus format.
|
||||
<2> The Prometheus job name.
|
||||
<3> The lnterval for scraping the metrics data. Accepts time units. The default value is `1m`.
|
||||
<4> The targets at which the metrics are exposed. This example scrapes the metrics from a `my-app` application in the `example` project.
|
||||
|
||||
[id="otlpjsonfile-receiver_{context}"]
|
||||
== OTLP JSON File Receiver
|
||||
|
||||
The OTLP JSON File Receiver extracts pipeline information from files containing data in the link:https://protobuf.dev/programming-guides/json/[ProtoJSON] format and conforming to the link:https://opentelemetry.io/docs/specs/otel/protocol/[OpenTelemetry Protocol] specification. The receiver watches a specified directory for changes such as created or modified files to process.
|
||||
|
||||
:FeatureName: The OTLP JSON File Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled OTLP JSON File Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
otlpjsonfile:
|
||||
include:
|
||||
- "/var/log/*.log" # <1>
|
||||
exclude:
|
||||
- "/var/log/test.log" # <2>
|
||||
# ...
|
||||
----
|
||||
<1> The list of file path glob patterns to watch.
|
||||
<2> The list of file path glob patterns to ignore.
|
||||
|
||||
[id="zipkin-receiver_{context}"]
|
||||
== Zipkin Receiver
|
||||
|
||||
The Zipkin Receiver ingests traces in the Zipkin v1 and v2 formats.
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled Zipkin Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
zipkin:
|
||||
endpoint: 0.0.0.0:9411 # <1>
|
||||
tls: {} # <2>
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [zipkin]
|
||||
# ...
|
||||
----
|
||||
<1> The Zipkin HTTP endpoint. If omitted, the default `+0.0.0.0:9411+` is used.
|
||||
<2> The server-side TLS configuration. See the OTLP Receiver configuration section for more details.
|
||||
|
||||
[id="kafka-receiver_{context}"]
|
||||
== Kafka Receiver
|
||||
|
||||
The Kafka Receiver receives traces, metrics, and logs from Kafka in the OTLP format.
|
||||
|
||||
:FeatureName: The Kafka Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled Kafka Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
kafka:
|
||||
brokers: ["localhost:9092"] # <1>
|
||||
protocol_version: 2.0.0 # <2>
|
||||
topic: otlp_spans # <3>
|
||||
auth:
|
||||
plain_text: # <4>
|
||||
username: example
|
||||
password: example
|
||||
tls: # <5>
|
||||
ca_file: ca.pem
|
||||
cert_file: cert.pem
|
||||
key_file: key.pem
|
||||
insecure: false # <6>
|
||||
server_name_override: kafka.example.corp # <7>
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [kafka]
|
||||
# ...
|
||||
----
|
||||
<1> The list of Kafka brokers. The default is `+localhost:9092+`.
|
||||
<2> The Kafka protocol version. For example, `+2.0.0+`. This is a required field.
|
||||
<3> The name of the Kafka topic to read from. The default is `+otlp_spans+`.
|
||||
<4> The plain text authentication configuration. If omitted, plain text authentication is disabled.
|
||||
<5> The client-side TLS configuration. Defines paths to the TLS certificates. If omitted, TLS authentication is disabled.
|
||||
<6> Disables verifying the server's certificate chain and host name. The default is `+false+`.
|
||||
<7> ServerName indicates the name of the server requested by the client to support virtual hosting.
|
||||
|
||||
[id="k8scluster-receiver_{context}"]
|
||||
== Kubernetes Cluster Receiver
|
||||
|
||||
The Kubernetes Cluster Receiver gathers cluster metrics and entity events from the Kubernetes API server. It uses the Kubernetes API to receive information about updates. Authentication for this receiver is only supported through service accounts.
|
||||
|
||||
:FeatureName: The Kubernetes Cluster Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled Kubernetes Cluster Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
k8s_cluster:
|
||||
distribution: openshift
|
||||
collection_interval: 10s
|
||||
exporters:
|
||||
debug: {}
|
||||
service:
|
||||
pipelines:
|
||||
metrics:
|
||||
receivers: [k8s_cluster]
|
||||
exporters: [debug]
|
||||
logs/entity_events:
|
||||
receivers: [k8s_cluster]
|
||||
exporters: [debug]
|
||||
# ...
|
||||
----
|
||||
|
||||
This receiver requires a configured service account, RBAC rules for the cluster role, and the cluster role binding that binds the RBAC with the service account.
|
||||
|
||||
.`ServiceAccount` object
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
labels:
|
||||
app: otelcontribcol
|
||||
name: otelcontribcol
|
||||
# ...
|
||||
----
|
||||
|
||||
.RBAC rules for the `ClusterRole` object
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: otelcontribcol
|
||||
labels:
|
||||
app: otelcontribcol
|
||||
rules:
|
||||
- apiGroups:
|
||||
- quota.openshift.io
|
||||
resources:
|
||||
- clusterresourcequotas
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
- namespaces
|
||||
- namespaces/status
|
||||
- nodes
|
||||
- nodes/spec
|
||||
- pods
|
||||
- pods/status
|
||||
- replicationcontrollers
|
||||
- replicationcontrollers/status
|
||||
- resourcequotas
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- daemonsets
|
||||
- deployments
|
||||
- replicasets
|
||||
- statefulsets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- daemonsets
|
||||
- deployments
|
||||
- replicasets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
- cronjobs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- autoscaling
|
||||
resources:
|
||||
- horizontalpodautoscalers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# ...
|
||||
----
|
||||
|
||||
.`ClusterRoleBinding` object
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: otelcontribcol
|
||||
labels:
|
||||
app: otelcontribcol
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: otelcontribcol
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: otelcontribcol
|
||||
namespace: default
|
||||
# ...
|
||||
----
|
||||
|
||||
[id="opencensus-receiver_{context}"]
|
||||
== OpenCensus Receiver
|
||||
|
||||
The OpenCensus Receiver provides backwards compatibility with the OpenCensus project for easier migration of instrumented codebases. It receives metrics and traces in the OpenCensus format via gRPC or HTTP and Json.
|
||||
|
||||
[WARNING]
|
||||
====
|
||||
The OpenCensus Receiver is deprecated and might be removed in a future release.
|
||||
====
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled OpenCensus Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
opencensus:
|
||||
endpoint: 0.0.0.0:9411 # <1>
|
||||
tls: # <2>
|
||||
cors_allowed_origins: # <3>
|
||||
- https://*.<example>.com
|
||||
service:
|
||||
pipelines:
|
||||
traces:
|
||||
receivers: [opencensus]
|
||||
# ...
|
||||
----
|
||||
<1> The OpenCensus endpoint. If omitted, the default is `+0.0.0.0:55678+`.
|
||||
<2> The server-side TLS configuration. See the OTLP Receiver configuration section for more details.
|
||||
<3> You can also use the HTTP JSON endpoint to optionally configure CORS, which is enabled by specifying a list of allowed CORS origins in this field.
|
||||
Wildcards with `+*+` are accepted under the `cors_allowed_origins`.
|
||||
To match any origin, enter only `+*+`.
|
||||
|
||||
[id="filelog-receiver_{context}"]
|
||||
== Filelog Receiver
|
||||
|
||||
The Filelog Receiver tails and parses logs from files.
|
||||
|
||||
:FeatureName: The Filelog Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled Filelog Receiver that tails a text file
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
config:
|
||||
receivers:
|
||||
filelog:
|
||||
include: [ /simple.log ] # <1>
|
||||
operators: # <2>
|
||||
- type: regex_parser
|
||||
regex: '^(?P<time>\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}) (?P<sev>[A-Z]*) (?P<msg>.*)$'
|
||||
timestamp:
|
||||
parse_from: attributes.time
|
||||
layout: '%Y-%m-%d %H:%M:%S'
|
||||
severity:
|
||||
parse_from: attributes.sev
|
||||
# ...
|
||||
----
|
||||
<1> A list of file glob patterns that match the file paths to be read.
|
||||
<2> An array of Operators. Each Operator performs a simple task such as parsing a timestamp or JSON. To process logs into a desired format, chain the Operators together.
|
||||
|
||||
[id="journald-receiver_{context}"]
|
||||
== Journald Receiver
|
||||
|
||||
The Journald Receiver parses *journald* events from the *systemd* journal and sends them as logs.
|
||||
|
||||
:FeatureName: The Journald Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled Journald Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: v1
|
||||
kind: Namespace
|
||||
metadata:
|
||||
name: otel-journald
|
||||
labels:
|
||||
security.openshift.io/scc.podSecurityLabelSync: "false"
|
||||
pod-security.kubernetes.io/enforce: "privileged"
|
||||
pod-security.kubernetes.io/audit: "privileged"
|
||||
pod-security.kubernetes.io/warn: "privileged"
|
||||
# ...
|
||||
---
|
||||
apiVersion: v1
|
||||
kind: ServiceAccount
|
||||
metadata:
|
||||
name: privileged-sa
|
||||
namespace: otel-journald
|
||||
# ...
|
||||
---
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRoleBinding
|
||||
metadata:
|
||||
name: otel-journald-binding
|
||||
roleRef:
|
||||
apiGroup: rbac.authorization.k8s.io
|
||||
kind: ClusterRole
|
||||
name: system:openshift:scc:privileged
|
||||
subjects:
|
||||
- kind: ServiceAccount
|
||||
name: privileged-sa
|
||||
namespace: otel-journald
|
||||
# ...
|
||||
---
|
||||
apiVersion: opentelemetry.io/v1beta1
|
||||
kind: OpenTelemetryCollector
|
||||
metadata:
|
||||
name: otel-journald-logs
|
||||
namespace: otel-journald
|
||||
spec:
|
||||
mode: daemonset
|
||||
serviceAccount: privileged-sa
|
||||
securityContext:
|
||||
allowPrivilegeEscalation: false
|
||||
capabilities:
|
||||
drop:
|
||||
- CHOWN
|
||||
- DAC_OVERRIDE
|
||||
- FOWNER
|
||||
- FSETID
|
||||
- KILL
|
||||
- NET_BIND_SERVICE
|
||||
- SETGID
|
||||
- SETPCAP
|
||||
- SETUID
|
||||
readOnlyRootFilesystem: true
|
||||
seLinuxOptions:
|
||||
type: spc_t
|
||||
seccompProfile:
|
||||
type: RuntimeDefault
|
||||
config:
|
||||
receivers:
|
||||
journald:
|
||||
files: /var/log/journal/*/*
|
||||
priority: info # <1>
|
||||
units: # <2>
|
||||
- kubelet
|
||||
- crio
|
||||
- init.scope
|
||||
- dnsmasq
|
||||
all: true # <3>
|
||||
retry_on_failure:
|
||||
enabled: true # <4>
|
||||
initial_interval: 1s # <5>
|
||||
max_interval: 30s # <6>
|
||||
max_elapsed_time: 5m # <7>
|
||||
processors:
|
||||
exporters:
|
||||
debug: {}
|
||||
service:
|
||||
pipelines:
|
||||
logs:
|
||||
receivers: [journald]
|
||||
exporters: [debug]
|
||||
volumeMounts:
|
||||
- name: journal-logs
|
||||
mountPath: /var/log/journal/
|
||||
readOnly: true
|
||||
volumes:
|
||||
- name: journal-logs
|
||||
hostPath:
|
||||
path: /var/log/journal
|
||||
tolerations:
|
||||
- key: node-role.kubernetes.io/master
|
||||
operator: Exists
|
||||
effect: NoSchedule
|
||||
# ...
|
||||
----
|
||||
<1> Filters output by message priorities or priority ranges. The default value is `info`.
|
||||
<2> Lists the units to read entries from. If empty, entries are read from all units.
|
||||
<3> Includes very long logs and logs with unprintable characters. The default value is `false`.
|
||||
<4> If set to `true`, the receiver pauses reading a file and attempts to resend the current batch of logs when encountering an error from downstream components. The default value is `false`.
|
||||
<5> The time interval to wait after the first failure before retrying. The default value is `1s`. The units are `ms`, `s`, `m`, `h`.
|
||||
<6> The upper bound for the retry backoff interval. When this value is reached, the time interval between consecutive retry attempts remains constant at this value. The default value is `30s`. The supported units are `ms`, `s`, `m`, `h`.
|
||||
<7> The maximum time interval, including retry attempts, for attempting to send a logs batch to a downstream consumer. When this value is reached, the data are discarded. If the set value is `0`, retrying never stops. The default value is `5m`. The supported units are `ms`, `s`, `m`, `h`.
|
||||
|
||||
[id="kubernetesevents-receiver_{context}"]
|
||||
== Kubernetes Events Receiver
|
||||
|
||||
The Kubernetes Events Receiver collects events from the Kubernetes API server. The collected events are converted into logs.
|
||||
|
||||
:FeatureName: The Kubernetes Events Receiver
|
||||
include::snippets/technology-preview.adoc[]
|
||||
|
||||
.OpenShift Container Platform permissions required for the Kubernetes Events Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
apiVersion: rbac.authorization.k8s.io/v1
|
||||
kind: ClusterRole
|
||||
metadata:
|
||||
name: otel-collector
|
||||
labels:
|
||||
app: otel-collector
|
||||
rules:
|
||||
- apiGroups:
|
||||
- ""
|
||||
resources:
|
||||
- events
|
||||
- namespaces
|
||||
- namespaces/status
|
||||
- nodes
|
||||
- nodes/spec
|
||||
- pods
|
||||
- pods/status
|
||||
- replicationcontrollers
|
||||
- replicationcontrollers/status
|
||||
- resourcequotas
|
||||
- services
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- apps
|
||||
resources:
|
||||
- daemonsets
|
||||
- deployments
|
||||
- replicasets
|
||||
- statefulsets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- extensions
|
||||
resources:
|
||||
- daemonsets
|
||||
- deployments
|
||||
- replicasets
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- batch
|
||||
resources:
|
||||
- jobs
|
||||
- cronjobs
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
- apiGroups:
|
||||
- autoscaling
|
||||
resources:
|
||||
- horizontalpodautoscalers
|
||||
verbs:
|
||||
- get
|
||||
- list
|
||||
- watch
|
||||
# ...
|
||||
----
|
||||
|
||||
.OpenTelemetry Collector custom resource with the enabled Kubernetes Event Receiver
|
||||
[source,yaml]
|
||||
----
|
||||
# ...
|
||||
serviceAccount: otel-collector # <1>
|
||||
config:
|
||||
receivers:
|
||||
k8s_events:
|
||||
namespaces: [project1, project2] # <2>
|
||||
service:
|
||||
pipelines:
|
||||
logs:
|
||||
receivers: [k8s_events]
|
||||
# ...
|
||||
----
|
||||
<1> The service account of the Collector that has the required ClusterRole `otel-collector` RBAC.
|
||||
<2> The list of namespaces to collect events from. The default value is empty, which means that all namespaces are collected.
|
||||
|
||||
[role="_additional-resources"]
|
||||
[id="additional-resources_{context}"]
|
||||
[role="_additional-resources"]
|
||||
== Additional resources
|
||||
* link:https://opentelemetry.io/docs/specs/otlp/[OpenTelemetry Protocol (OTLP)] (OpenTelemetry Documentation)
|
||||
* link:https://opentelemetry.io/docs/specs/otlp/[OpenTelemetry Documentation: OpenTelemetry Protocol (OTLP)]
|
||||
|
||||
Reference in New Issue
Block a user