Skip to content

Collector is unable to find the file to export to even though the file exists. #22065

Closed as not planned
@sai-sunder-s

Description

Component(s)

No response

What happened?

Description

I am experimenting with otel logging in my local machine. I want to export the logs to a file. I get file not found issue.

Steps to Reproduce

Expected Result

Wanted the collector to write the logs to a json file.

Actual Result

Got an error saying the file is not found. (Full Error in log output section below)

Collector version

v0.77.0

Environment information

Environment

OS: Debian GNU

OpenTelemetry Collector configuration

# otel-collector-config.yaml
receivers:
  otlp:
    protocols:
      grpc:
      http:

exporters:
  file:
    path: ~/data/playground/opentelemetry/otel-getting-started/logsotel.json
  logging:
    verbosity: detailed

processors:
  batch:

service:
  telemetry:
    logs:
      level: debug
   
  pipelines:
      logs:
          receivers: [otlp]
          processors: [batch]
          exporters: [file]

Log output

2023-05-18T05:06:50.529Z	info	service/telemetry.go:113	Setting up own telemetry...
2023-05-18T05:06:50.530Z	info	service/telemetry.go:136	Serving Prometheus metrics	{"address": ":8888", "level": "Basic"}
2023-05-18T05:06:50.530Z	debug	exporter@v0.77.0/exporter.go:284	Alpha component. May change in the future.	{"kind": "exporter", "data_type": "logs", "name": "file"}
Error: failed to build pipelines: failed to create "file" exporter for data type "logs": open ~/data/playground/opentelemetry/otel-getting-started/logsotel.json: no such file or directory
2023/05/18 05:06:50 collector server run finished with error: failed to build pipelines: failed to create "file" exporter for data type "logs": open ~/data/playground/opentelemetry/otel-getting-started/logsotel.json: no such file or directory

Additional context

No response

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions