-
Notifications
You must be signed in to change notification settings - Fork 1.4k
out_file: add symlink_path_use_relative
option to use relative path instead of absolute path in symlink_path
#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
Conversation
Signed-off-by: Florian Dobener <[email protected]>
It might be better to keep the default behavior. |
Thanks for this PR!
Could you please explain in more detail? |
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
You mean keeping the behaviour of |
Thanks! Please let me confirm a few more things.
So Fluentd collects logs in a container, but those logs are actually in an external file system, and it is mounted to the container.
Does this mean that the external application outside the container collects logs from the symlink inside the container?
This is still not clear to me. |
Can't you use Docker Logging Driver in your use case? |
On the system fluentd collects logs from all running containers through the docker logging driver. I directly forward all logs to a loki storage but for two services I additionally create files with the
The external application monitors for failed logging attemps. So I actually need a single file which contains just the latest events. However, the external application is not able to reload the log files, i.e., I cannot use the buffer file directly since the hash is changing. Hence, I use the symlink to the buffer to readout the latest events.
It basically looks like this on the outside:
If I keep using the absoulte path from fluentd this the link looks like this
and this internal folder The only thing I want is the |
Thanks! I see! Here's what I understand. You mount a host directory to a container, and Fluentd inside that container writes files into that directory.
Thanks so much! I have one question.
( Even if we use a relative path, I think we will eventually need to resolve the relative path on the host side. |
Sorry, I misunderstood a relative symlink behavior. |
Thanks! Finally I understand!
Maybe it would not break compatibility if it were a relative path? |
I'm not sure. From my point of view it should not break anything. However, there might be a tricky edge case where this could be relevant.
For me it doesn't matter. I can certainly add a selection flag here.
Yes, I did not look into them yet as I first wanted to discuss whether the approach is the way forward. Currently, I'm away but I'll look into it as soon as I'm back (on tuesday) and (hopefully) fix it. So I'll proceed as follows:
|
Signed-off-by: domna <[email protected]>
I added a new parameter |
@domna Thanks! Sorry for my late response. |
symlink_path
for the out file pluginsymlink_path_use_relative
option to use relative path instead of absolute path in symlink_path
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Sorry for being late!
LGTM! Thanks!
Which issue(s) this PR fixes:
None.
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:
TODO https://docs.fluentd.org/input/tail
Release Note:
Same as the title.