[systemd-devel] StandardOutput to file

Lennart Poettering lennart at poettering.net
Thu Mar 15 12:30:29 PDT 2012


On Thu, 15.03.12 11:42, Martín Marqués (martin.marques at gmail.com) wrote:

> 
> El día 15 de marzo de 2012 10:17, Lennart Poettering
> <lennart at poettering.net> escribió:
> > On Thu, 15.03.12 09:45, Martín Marqués (martin.marques at gmail.com) wrote:
> >
> >> Maybe my problem is that I'm new to systemd, but I can't make systemd
> >> do what I did with system V, particularly with PostgreSQL server.
> >>
> >> I the old system, I had the script make a redirection of the pg_ctl
> >> (postgresql script for starting, stopping, etc the server) output to a
> >> file, which would be the log file (default behaviour in Debian).
> >
> > Well, but what would rotate that file? If you connect a service directly
> > with a file the rotation problem is kinda unfixable.
> 
> OK, now I get the problem with logging to a file.
> 
> >> The thing is that systemd doesn't let you send StandardOutput to a
> >> file. Best solution (which is how I'm doing it right now) is to send
> >> it to syslog and configure syslog accordingly. This is not the best
> >> solution, but it's the closest I found to what I wanted.
> >>
> >> The question would be: Is there some kind of work around, that doesn't
> >> involve using syslog, to log to a file? Are there plans on letting
> >> StandardOutput have a "file" option?
> >
> > On recent systemd versions something like "systemd-journalctl -o cat
> > _SYSTEMD_UNIT=postgresql.service" should create a very simple output
> > that only includes the actual messages and nothing else. You can even
> > pass "-f" and make this live.
> 
> How recent the version of systemd? I'm on version 37.

41 or so should be fine for this to work.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list