Discussion:
Systemd logging..
(too old to reply)
deepan muthusamy
2018-11-21 08:53:50 UTC
Permalink
Hi,
How to log systemd service into log.txt file.
This file should be available after system restart also.
How to do this?
Reindl Harald
2018-11-21 09:36:16 UTC
Permalink
Post by deepan muthusamy
How to log systemd service into log.txt file.
This file should be available after system  restart also.
How to do this?
just use rsyslog a all the years before

rsyslog.conf:
$MainMsgQueueSize 100000
$WorkDirectory /var/lib/rsyslog
module(load="imjournal" StateFile="imjournal.state"
WorkAroundJournalBug="on")
$ActionFileDefaultTemplate RSYSLOG_TraditionalFileFormat
$MaxMessageSize 4096
:programname, isequal, "dhcpd" -/var/log/dhcpd.log
:programname, isequal, "dhcpd" stop
deepan muthusamy
2018-11-21 14:08:24 UTC
Permalink
Hi,
Still iam not clear about what to do in service.

Can u please tell me what are all the things I have to add in .service file
to store all logs into a log file.
Post by deepan muthusamy
Hi,
How to log systemd service into log.txt file.
This file should be available after system restart also.
How to do this?
Reindl Harald
2018-11-21 16:13:04 UTC
Permalink
Post by deepan muthusamy
Hi,
Still iam not clear about what to do in service.
Can u please tell me what are all the things I have to add in .service
what exactly did you not understand in my repsonse that you need to use
rsyslog for traditional logfiles and why do you respond to your own post
instead already existing answers?
Post by deepan muthusamy
file to store all logs into a log file.
Hi, 
How to log systemd service into log.txt file.
This file should be available after system  restart also.
How to do this?
Cristian Rodríguez
2018-11-22 12:24:32 UTC
Permalink
Post by deepan muthusamy
Can u please tell me what are all the things I have to add in .service
file to store all logs into a log file.
Some daemons provide an option to log to file, use that if available,
otherwise make your program write debug or log messages to stderr and
the journal will capture it.. then you can extract them to a text file.
Tomasz Torcz
2018-11-22 14:16:48 UTC
Permalink
Post by deepan muthusamy
Hi,
How to log systemd service into log.txt file.
This file should be available after system restart also.
How to do this?
You can use file:path in StandardOutput=
https://www.freedesktop.org/software/systemd/man/systemd.exec.html#StandardOutput=
--
Tomasz Torcz "Funeral in the morning, IDE hacking
xmpp: ***@chrome.pl in the afternoon and evening." - Alan Cox
Continue reading on narkive:
Loading...