Skip to content
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

Failed to start tail on relative symbolic link #11

Closed
RangerCD opened this issue Dec 8, 2021 · 0 comments · Fixed by #12
Closed

Failed to start tail on relative symbolic link #11

RangerCD opened this issue Dec 8, 2021 · 0 comments · Fixed by #12

Comments

@RangerCD
Copy link
Contributor

RangerCD commented Dec 8, 2021

When I'm trying to start tailing on a relative symbolic link, it keeps throwing errors like these:

ts=2021-12-08T07:28:33.967830957Z caller=level.go:63 level=error msg="failed to start tailer" error="open test.log.2021-12-08: no such file or directory" filename=/home/rangercd/temp/test.log
ts=2021-12-08T07:28:43.9682562Z caller=level.go:63 level=error msg="failed to start tailer" error="open test.log.2021-12-08: no such file or directory" filename=/home/rangercd/temp/test.log

I have these files in /home/rangercd/temp/:

total 4.0K
lrwxrwxrwx 1 rangercd rangercd 19 Dec  8 15:42 test.log -> test.log.2021-12-08
-rw-r--r-- 1 rangercd rangercd  5 Dec  8 15:41 test.log.2021-12-08

Since my program's working directory is not /home/rangercd/temp/ (for example it's running in /tmp/) , this line overwrites filename with a wrong relative path test.log.2021-12-08:

filename, err = os.Readlink(name)

So it's actually trying to open /tmp/test.log.2021-12-08, which is not exists.

And I believe it should be filepath.EvalSymlinks here instead of os.Readlink

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 a pull request may close this issue.

1 participant