3

I have an application that writes logs to some file e.g. /var/log/mylog.txt

However, I want it to be written to journald (so that it can be accessed via journalctl). I can't change way of launching of application, as it is encapsulated from me.

Any ideas?

1

You could use systemd-cat, e.g.

 systemd-cat cat /path/to/log

or

 systemd-cat -t encapsulated_app_log tail -f /path/to/log
  • I tried the second option but it doesn't seem to work. Did you check it? I'm just wondering in case I've done something wrong – Rahul Feb 26 '17 at 6:59
  • @RahulKatrakhtalapali - works fine here... Note that if you're doing it as a user you will have to run journalctl as that specific user to get the expected output – don_crissti Feb 26 '17 at 11:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.