Closed tino closed 1 month ago
Hi @tino ,
Did you check JournalD to see if the output is there? I think the difference is that the console
sink writes to stdout
but Vector's internal logs go to stderr
. Both should end up in JournalD by default though. See https://www.freedesktop.org/software/systemd/man/latest/systemd.exec.html#StandardOutput=
Yes I did. As I showed in my initial post, those are the logs from JournalD (sudo journalctl -fu vector
).
And I also don't see these in Loki.
OK I found the difference. When I start as systemd job, vector runs under the vector
user. However vector does have access to the file I want it to read, with world group permission.
ls -alh /path/to/logs/service1.log
-rw-r-xr--+ 1 tino tino 2.9M May 12 21:20 /path/to/logs/service1.log
And I even tried with with setfacl:
$ getfacl /path/to/logs/service1.log
getfacl: Removing leading '/' from absolute path names
# file: path/to/logs/service1.log
# owner: tino
# group: tino
user::rw-
user:vector:r-x
group::r--
mask::r-x
other::r--
So why wouldn't that work? Does it need write access too?
OK I found the difference. When I start as systemd job, vector runs under the
vector
user. However vector does have access to the file I want it to read, with world group permission.ls -alh /path/to/logs/service1.log -rw-r-xr--+ 1 tino tino 2.9M May 12 21:20 /path/to/logs/service1.log
And I even tried with with setfacl:
$ getfacl /path/to/logs/service1.log getfacl: Removing leading '/' from absolute path names # file: path/to/logs/service1.log # owner: tino # group: tino user::rw- user:vector:r-x group::r-- mask::r-x other::r--
So why wouldn't that work? Does it need write access too?
I would check all parent directories too to make sure it has access. You could run sudo -u vector head <full path>
to check if the vector
user can read the file.
Closing as stale, but let me know if you are still having issues!
A note for the community
Problem
When started with
sudo vector
it works and my logs are processed. When starting with the same config file, but withsudo systemctl start vector
there is no output, not in the console, and ontop
everything stays atN/A
.In both cases I waited long enough and checked that there was actually stuff added to the log file.
Configuration
Version
vector 0.36.1 (x86_64-unknown-linux-gnu 2857180 2024-03-11 14:32:52.417737479)
Debug Output
The last 2 lines are the ones I want to see.
From journalctl, when started with
sudo systemctl start vector
: