Skip to content

filelog strogae directory must exist: stat /var/lib/otelcol/file_storage: no such file or directory #34277

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

Closed
wangjinxiang0522 opened this issue Jul 27, 2024 · 6 comments

Comments

@wangjinxiang0522
Copy link

wangjinxiang0522 commented Jul 27, 2024

Component(s)

extension/storage

Describe the issue you're reporting

version: v0.105.0

extensions:
health_check:
endpoint: ${env:MY_POD_IP}:13133
file_storage/default:
directory: /var/lib/otelcol/file_storage

Error: invalid configuration: extensions::file_storage/default: directory must exist: stat /var/lib/otelcol/file_storage: no such file or directory

Copy link
Contributor

Pinging code owners:

See Adding Labels via Comments if you do not have permissions to add labels yourself.

@ChrsMark
Copy link
Member

I guess the error message is quite precise: Error: invalid configuration: extensions::file_storage/default: directory must exist: stat /var/lib/otelcol/file_storage: no such file or directory

Indeed, the directory for the file_storage must exist: https://github.com/open-telemetry/opentelemetry-collector-contrib/tree/main/extension/storage/filestorage#file-storage

Hence we can close it, unless the purpose is to propose to change this behavior.

@VihasMakwana
Copy link
Contributor

@wangjinxiang0522 create a directory with mkdir -p /var/lib/otelcol/file_storage and it should work when you restart it.

@wangjinxiang0522
Copy link
Author

I'm running in a Kubernetes environment, and the directory is not created in the otel-contrib-collector image.

yaml
initContainers:
- name: init-filelog-receivers
image: reg.sprucetec.com/monitor/docker.io/library/busybox:1.28
command: ['sh', '-c', 'mkdir -p /var/lib/filelog/receivers && chmod 777 /var/lib/filelog/receivers']
volumeMounts:
- name: filelog-receivers
mountPath: /var/lib/filelog/receivers
containers:
- name: opentelemetry-collector
command:
- /otelcol-contrib
- --config=/conf/relay.yaml
securityContext:
{}
image: "reg.sprucetec.com/monitor/mc-otel-contrib-collector:0.105.25"
imagePullPolicy: IfNotPresent

I created the file using an initContainer, which solved the problem. Thanks, everyone!

@VihasMakwana
Copy link
Contributor

@ChrsMark I think this is good to close

@ChrsMark
Copy link
Member

@wangjinxiang0522 since you are on K8s you can check how the Collector Helm Charts deal with that.

Specifically the storeCheckpoints preset at https://github.com/open-telemetry/opentelemetry-helm-charts/blob/main/charts/opentelemetry-collector/templates/_pod.tpl#L170 defines the hostPath with DirectoryOrCreate. This can remove the need for the initContainer.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants