summaryrefslogtreecommitdiffstats
path: root/misc-utils/logger.c
Commit message (Collapse)AuthorAgeFilesLines
* build-sys: remove unnecessary void castsSami Kerola2014-05-121-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: check numeric priority and facility input valuesSami Kerola2014-05-121-3/+14
| | | | | | | | Earlier use of unknown facility or priority number was accepted, and resulted in unexpected result. For example when looking journalctl --priority=7.8 was converted to priotity 0 and facility 1. Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: fail when io vector number exceeds maximumSami Kerola2014-05-121-1/+6
| | | | | | | | | Earlier version silently failed without logging anything. $ logger --journald=/etc/services ; echo $? 1 Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* build-sys: consolidate systemd supportKarel Zak2014-04-091-7/+7
| | | | | | | | | | | | | | | * systemd (since v209) uses only one library (when compiled without --enable-compat-libs) * all systemd build-sys stuff is merged into HAVE_SYSTEMD (automake) and HAVE_LIBSYSTEMD (C macro) now * all is controlled by --with-systemd, default is to automatically check for systemd libs * no more --enable-socket-activation and --enable-journald Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: allow user to send structured journald messagesSami Kerola2014-03-041-2/+69
| | | | | | | | | | | | | This feature is hopefully mostly used to give MESSAGE_ID labels for messages coming from scripts, making search of messages easy. The logger(1) manual page update should give enough information how to use --journald option. [kzak@redhat.com: - add missing #ifdefs - use xalloc.h] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* textual: fix several typos and angular brackets in messagesBenno Schulenberg2013-06-071-3/+3
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: small coding style changesKarel Zak2013-05-291-8/+7Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: cleanup usage()Karel Zak2013-05-291-15/+17
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: add support for --prio-prefix when logging stdinDennis H Jensen2013-05-291-4/+41
| | | | | | | | | | | | | | | | This patch adds a new option to logger that will make it look for a priority prefix <n> at the beginning of every line. The priority is a single decimal number formed as explained in syslog(3). If a prefix is found logger will log the message using the found facility and level in that prefix, if the prefix doesn't contain a facility the default facility specified by the -p option will be used. If no prefix is found, logger will use the priority specified by -p. [kzak@redhat.com: - add --prio-prefix to usage() output] Signed-off-by: Dennis H Jensen <dennis.h.jensen@siemens.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: make socket initialization in main() more readableKarel Zak2013-04-081-4/+4
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: allow to log using tcp transport protocolSami Kerola2013-04-081-50/+88
| | | | | | | | | | | | | | | | | This commit fixes error in usage() text, which claimed TCP is default transport protocol. That was not true, and neither it should be. The syslog messages has traditionally sent using UDP. For the logger remains using UDP as first transport, but if it fails a TCP connection is attempted. If an user wishes remote logging can be forced to use either UDP or TCP. The service port for UDP is familiar 'syslog', for TCP the port 'syslog-conn' seems like reasonable default. [kzak@redhat.com: - rename myopenlog to unix_socket(), - always reset st to -1] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: make local sockets to try both stream and datagramSami Kerola2013-04-051-17/+25
| | | | | | | | | | | | | | | | | | | When journald, from systemd, is in use logger gave following error. $ logger --socket /dev/log test logger: connect /dev/log: Protocol wrong type for socket The journald supports only AF_DGRAM, and nothing else. Support for AF_STREAM sockets was dropped because it messed up message ordering. From an users point of view necessity to add --udp (UNIX(TM) Datagram Protocol?) option when talking to syslog via unix socket felt confusing and wrong. The command should know what is the socket type, and silently use the correct one, unless the type is explicitely defined. CC: Karel Zak <kzak@redhat.com> Adviced-by: Lennart Poettering <lennart@poettering.net> Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* textual: spell and encode the name of Arkadiusz Miśkiewicz correctlyBenno Schulenberg2013-02-061-1/+1
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* textual: use UTIL_LINUX_VERSION everywhereKarel Zak2013-01-251-2/+1Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: replace gethostbyname() with getaddrinfo()Sami Kerola2012-10-221-17/+17
| | | | | | | | The gethostbyname() is legacy function which may be withdrawn in a future. Reference: http://pubs.opengroup.org/onlinepubs/009695399/functions/gethostbyname.html Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: use memcpy instead of bcopyDave Reisner2012-05-291-1/+1
| | | | | | bcopy is marked legacy in POSIX.1-2001 and should not be used. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* logger: mark decode/pencode as staticDave Reisner2012-05-291-47/+37Star
| | | | | | | Move these functions to the top of the file where they can be marked static and the prototypes can be removed. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* logger: avoid explicit fclose(stdout)Dave Reisner2012-05-291-2/+0Star
| | | | | | | This is done for us via an atexit hook since c05a80ca6385b8. Avoids a useless 'Write error' on exit whenever invoking the tool. Signed-off-by: Dave Reisner <dreisner@archlinux.org>
* misc-utils: cleanup unused strings.h includesmaximilian attems2012-05-231-1/+0Star
| | | | | | Noticed on klibc building. Signed-off-by: maximilian attems <max@stro.at>
* Merge branch 'master' of https://github.com/jhuntwork/util-linuxKarel Zak2012-05-231-2/+2
|\
| * Remove use of __P. Its intended usage was to support pre-ANSI C compilers, ↵Jeremy Huntwork2012-05-131-2/+2
| | | | | | | | but that is not even possible with the modern-day codebase. Moreover, it breaks compiling on libcs that do not define this legacy implementation-internal macro.
* | misc-utils: cleanup strtoxx_or_err()Karel Zak2012-05-151-9/+4Star
|/ | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* misc-utils: verify writing to streams was successfulSami Kerola2012-04-041-0/+2
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: fix remote loggingKarel Zak2011-12-081-3/+3
| | | | | Reported-by: Hervé Quillévéré <herve_quillevere@herveq.tk> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: non-ANSI definition [smatch scan]Karel Zak2011-09-121-5/+2Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: indent usage()Karel Zak2011-08-161-19/+15Star
| | | | Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: improve, sort and slice up usage() help textBenno Schulenberg2011-08-161-12/+14
| | | | Signed-off-by: Benno Schulenberg <bensberg@justemail.net>
* logger: use libc error printing facilitiesSami Kerola2011-03-081-43/+29Star
| | | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: support long optionsSami Kerola2011-03-081-12/+59
| | | | | | | | | | | Use getopt_long and usage output changed to match long options. This patch will also scrutiny argument of formerly undocumented -P option. [kzak@redhat.com: - include c.h] Signed-off-by: Sami Kerola <kerolasa@iki.fi> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: fix variable type compiler warningSami Kerola2011-03-081-1/+1
| | | | Signed-off-by: Sami Kerola <kerolasa@iki.fi>
* logger: support for logging to UDP socket / remote syslog serverWUEBBELS, Josef \(Extern\)2011-02-141-4/+43
| | | | | | | | | | | It adds the ability to logger to log a message to a udp socket. The -n option followed by the hostname of the remote host is mandatory to do this. The optional -P option can be used to change the UDP destination port (default 514). The function udpopenlog is used to open the udp socket. After that everything works in almost the same way like it does when logging to a UNIX socket. Signed-off-by: Josef Wuebbels <josef.wuebbels@mtu.de>
* replace bcopy,bzero,index and rindexDaniel Mierswa2009-08-171-1/+1
| | | | | | | | | Those 4 functions are marked as LEGACY in POSIX.1-2001 and removed in POSIX.1-2008. Replaced with memmove,memset,strchr and strrchr. Signed-off-by: Daniel Mierswa <impulze@impulze.org>
* logger: several strings without gettext callsPedro Ribeiro2008-10-031-3/+3
| | | | | Signed-off-by: Pedro Ribeiro <p.m42.ribeiro@gmail.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* logger: use snprintf instead of sprintf in logger.cLaMont Jones2007-07-241-4/+2Star
| | | | | Signed-off-by: LaMont Jones <lamont@mmjgroup.com> Signed-off-by: Karel Zak <kzak@redhat.com>
* Imported from util-linux-2.12d tarball.Karel Zak2006-12-071-0/+1
|
* Imported from util-linux-2.11o tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.11b tarball.Karel Zak2006-12-071-1/+1
|
* Imported from util-linux-2.10s tarball.Karel Zak2006-12-071-7/+17
|
* Imported from util-linux-2.10m tarball.Karel Zak2006-12-071-17/+6Star
|
* Imported from util-linux-2.10f tarball.Karel Zak2006-12-071-0/+7
|
* Imported from util-linux-2.9v tarball.Karel Zak2006-12-071-12/+112
|
* Imported from util-linux-2.8 tarball.Karel Zak2006-12-071-10/+0Star
|
* Imported from util-linux-2.2 tarball.Karel Zak2006-12-071-0/+192