From mboxrd@z Thu Jan 1 00:00:00 1970 From: Danny Milosavljevic Subject: Re: where to put helper to send stdout/stderr to syslog? Date: Mon, 17 Jun 2019 14:45:49 +0200 Message-ID: <20190617144549.3430003f@scratchpost.org> References: Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-sha256; boundary="Sig_/cMaLH5LCEaCyDUSs0boVg48"; protocol="application/pgp-signature" Return-path: Received: from eggs.gnu.org ([2001:470:142:3::10]:45482) by lists.gnu.org with esmtp (Exim 4.86_2) (envelope-from ) id 1hcr1Z-0000Q0-KQ for guix-devel@gnu.org; Mon, 17 Jun 2019 08:46:16 -0400 Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71) (envelope-from ) id 1hcr1X-0003EO-ND for guix-devel@gnu.org; Mon, 17 Jun 2019 08:46:12 -0400 Received: from dd26836.kasserver.com ([85.13.145.193]:47660) by eggs.gnu.org with esmtps (TLS1.0:DHE_RSA_AES_256_CBC_SHA1:32) (Exim 4.71) (envelope-from ) id 1hcr1V-00032j-ML for guix-devel@gnu.org; Mon, 17 Jun 2019 08:46:11 -0400 In-Reply-To: List-Id: "Development of GNU Guix and the GNU System distribution." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: guix-devel-bounces+gcggd-guix-devel=m.gmane.org@gnu.org Sender: "Guix-devel" To: Robert Vollmert Cc: guix-devel@gnu.org --Sig_/cMaLH5LCEaCyDUSs0boVg48 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: quoted-printable Hi Robert, hmm, I like it in principle. But doesn't shepherd already log to /dev/kmsg and/or /dev/log (so that ends= up in syslog)? Since exec-command&co keep the standard output and standard er= ror, they (and thus all shepherd services) should also already log to the aforementioned syslog by default. What is the use case you envision? > Would logger-wrapper be generally useful to have available? If so, > is it named well, and where would it fit? I think it could be made part of shepherd and be exported there, then every= one could use it. Logging to syslog isn't exactly an obscure requirement :) Although shepherd already has its own /dev/log (syslog) client implementati= on, the external "logger" executable (or similar) is still necessary, because /dev/log is a UNIX domain socket and one can't write to UNIX domain sockets the same way one does pipes. Although it might be possible (and not advisable) to connect() the socket and then dup it to 1 and 2 for the child= :P P. S. The way you invoke logger (without full path or gexp package referenc= e) it will pick up a random logger implementation. I'm surprised that it works at all that way. P. S. Your implementation has shell injection because "name" could contain spaces and/or semicolons. I suggest not to use the shell command string but rather passing logger's argv directly. --Sig_/cMaLH5LCEaCyDUSs0boVg48 Content-Type: application/pgp-signature Content-Description: OpenPGP digital signature -----BEGIN PGP SIGNATURE----- iQEzBAEBCAAdFiEEds7GsXJ0tGXALbPZ5xo1VCwwuqUFAl0Hi30ACgkQ5xo1VCww uqX51gf9Ea1v7N/k5KAyl1x6ro7SOWoVfAsk1zEE43CTTJXVfifd7Rjo6KRUvYsN 9QylPtiN1vzijwVUakbOi5dB8kjVgcNo/7cM/lwhVPxHHvi/H0F8VnNzvy5Y9vtT Q/5X5vWA5eM7POnf1ENQfTzW32uG2paj010yy1k59zKnNIFBGvahzLrzqbb8eE8W LgK5hMrc8rZ7PP0zr7A2jZX5JxTWAV8GYq2Jykqln+dJ30qW+15oeg+WDMCetQj9 aKbKFjR31p5zSjdwi4JrVXP/tW+xH+INTN3Ac7CzkPnf71BmZOnq9DgXzpLANmoz tbftBHi7oaIfBLRP2Fhmi2Ugo9mocA== =eOKQ -----END PGP SIGNATURE----- --Sig_/cMaLH5LCEaCyDUSs0boVg48--