Skip to content

Use relative path instead of absolute path in symlink_path for the out file plugin #4904

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

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

domna
Copy link

@domna domna commented Apr 11, 2025

Which issue(s) this PR fixes:
There is no particular issue associated. If necessary I can create one.

What this PR does / why we need it:
This PR moves from an absolute link to a relative link for symlink_path parameter. Otherwise, this does not work in a dockerized environment where the path is wired to the the outside of the container.
I can also add an additional parameter to switch between absolute and relative linking if necessary and/or desired.

Docs Changes:
I think doc changes are not necassary. However, as far as I read it the documentation does not state whether its an absolute or relative link and it might be useful to add in the scope of this PR.

Release Note:
Uses relative link for symlink_path in the out file plugin.

Signed-off-by: Florian Dobener <[email protected]>
@Watson1978
Copy link
Contributor

Watson1978 commented Apr 14, 2025

It might be better to keep the default behavior.
If you want to use relative paths, please use the option function.

@daipom
Copy link
Contributor

daipom commented Apr 14, 2025

Thanks for this PR!

This PR moves from an absolute link to a relative link for symlink_path parameter. Otherwise, this does not work in a dockerized environment where the path is wired to the the outside of the container.

Could you please explain in more detail?
How do you use this relative simlink?

@domna
Copy link
Author

domna commented Apr 14, 2025

Could you please explain in more detail?
How do you use this relative simlink?

Sure. In my project I'm using fluentd to collect the logs in a docker compose stack. For some containers I want to write file based logs to disk, i.e., I mount them from the external fs into the container. I use the symlink_path to simulate some sort of log rotate pattern (where I have one fixed file keeping the latest logs), which I need for the application running on the bare metal system.
Now, using the symlink_path (as implemented before) works inside the fluentd container but it breaks on the outside, because the absolute path of the directory is obviously different.
I hope this makes it a bit clearer...

It might be better to keep the default behavior.
If you want to use relative paths, please use the option function.

You mean keeping the behaviour of symlink_path as an absolute link and adding an additional option, e.g., relative_symlink_path = true/false to switch to relative links? I can certainly implement it like this.

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

Successfully merging this pull request may close these issues.

3 participants