-
Notifications
You must be signed in to change notification settings - Fork 2.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to write logs via File Exporter in non OTLP JSON format #36515
Comments
Pinging code owners:
See Adding Labels via Comments if you do not have permissions to add labels yourself. |
@genadipost you can utilise the textencoding extension. |
Hi @VihasMakwana, I am using opentelemetry-kube-stack to gather k8s logs and metrics. This is the relevant part of the configuration:
|
@genadipost can you try this out? Haven't tested it, but it should work. exporters:
file:
encoding: text_encoding
path: /otel-data/otel-exporter.log
rotation:
max_backups: 15
max_megabytes: 50
extensions:
text_encoding:
encoding: utf8
file_storage:
directory: /var/lib/otelcol
processors:
batch:
send_batch_max_size: 1500
send_batch_size: 1000
timeout: 1s
k8sattributes:
extract:
labels:
- from: pod
key: app.kubernetes.io/name
tag_name: service.name
- from: pod
key: k8s-app
tag_name: service.name
- from: pod
key: app.kubernetes.io/instance
tag_name: k8s.app.instance
- from: pod
key: app.kubernetes.io/version
tag_name: service.version
- from: pod
key: app.kubernetes.io/component
tag_name: k8s.app.component
metadata:
- k8s.namespace.name
- k8s.pod.name
- k8s.pod.uid
- k8s.node.name
- k8s.pod.start_time
- k8s.deployment.name
- k8s.replicaset.name
- k8s.replicaset.uid
- k8s.daemonset.name
- k8s.daemonset.uid
- k8s.job.name
- k8s.job.uid
- k8s.container.name
- k8s.cronjob.name
- k8s.statefulset.name
- k8s.statefulset.uid
- container.image.tag
- container.image.name
- k8s.cluster.uid
filter:
node_from_env_var: K8S_NODE_NAME
pod_association:
- sources:
- from: resource_attribute
name: k8s.pod.uid
- sources:
- from: resource_attribute
name: k8s.pod.name
- from: resource_attribute
name: k8s.namespace.name
- from: resource_attribute
name: k8s.node.name
- sources:
- from: resource_attribute
name: k8s.pod.ip
- sources:
- from: resource_attribute
name: k8s.pod.name
- from: resource_attribute
name: k8s.namespace.name
- sources:
- from: connection
resourcedetection/env:
detectors:
- env
override: false
timeout: 2s
receivers:
filelog:
exclude: []
include:
- /var/log/pods/*/*/*.log
include_file_name: false
include_file_path: true
operators:
- id: container-parser
max_log_size: 102400
type: container
retry_on_failure:
enabled: true
start_at: end
storage: file_storage
service:
extensions:
- file_storage
- text_encoding
pipelines:
logs:
exporters:
- file
- debug
processors:
- k8sattributes
- resourcedetection/env
- batch
receivers:
- filelog |
@VihasMakwana It seems that |
Oh! I'll have a chat with codeowners and discuss this. |
@VihasMakwana Any ticket to follow on? |
Component(s)
exporter/file
Describe the issue you're reporting
I would like to export logs to a file using OpenTelemetry Collector File Exporter , also i would like to format the logs in logfmt format.
I was able to export the logs to a file but i am unable to find documentation which explains how to change the format of the logs.
Logs (also traces and metrics) seems can be exported in OTLP JSON format only.
The text was updated successfully, but these errors were encountered: