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?

sourcejedi
  • 48,311
  • 17
  • 143
  • 296
Rahul
  • 262
  • 1
  • 13

1 Answers1

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
don_crissti
  • 79,330
  • 30
  • 216
  • 245
  • 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 06: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