[systemd-devel] StandardOutput to file

Lennart Poettering lennart at poettering.net
Thu Mar 15 06:17:49 PDT 2012


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.

> 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. 

But I don't think supporting direct file ouputs makes much sense due to
the rotation problem.

Lennart

-- 
Lennart Poettering - Red Hat, Inc.


More information about the systemd-devel mailing list