summaryrefslogtreecommitdiff
path: root/log
Commit message (Collapse)AuthorAgeFilesLines
* logd: add support for subscribing to the log objectHEADmasterFelix Fietkau2023-01-191-1/+4
| | | | | | Provides easier access to log messages Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logread: fix erroneous message "Logread connected to" with udpGiovanni Giacobbi2021-08-031-2/+8
| | | | | | | | | | | | | | | | | When streaming the syslog messages via udp, the socket connection always succeeds by definition, but it can still fail to send. In such case, the syslog keep repeating the following two messages: failed to send log data to ip:port via udp Logread connected to ip:port With this change, only one initial message "Logread connected to..." is logged. Also fixed capital letter for "failed to send" message. Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net> Signed-off-by: Daniel Golle <daniel@makrotopia.org> (string de-duplication)
* logd: fix privilege dropping orderGiovanni Giacobbi2021-08-031-4/+4
| | | | | Fixes: 41664054b8b1 ("logd: fix ignored return values in set{gid,uid}") Signed-off-by: Giovanni Giacobbi <giovanni@giacobbi.net>
* logd: fix ignored return values in set{gid,uid}Petr Štetiar2021-03-221-2/+9
| | | | | | | | | | | | | | Ubuntu 18.05 with gcc-7.5 yields following error: ubox/log/logd.c:263:3: error: ignoring return value of ‘setuid’, declared with attribute warn_unused_result [-Werror=unused-result] setuid(p->pw_uid); ^~~~~~~~~~~~~~~~~ ubox/log/logd.c:264:3: error: ignoring return value of ‘setgid’, declared with attribute warn_unused_result [-Werror=unused-result] setgid(p->pw_gid); ^~~~~~~~~~~~~~~~~ Fixes: 9ef886819dd4 ("logd: self-degrade to 'logd' user after opening pipes") Signed-off-by: Petr Štetiar <ynezz@true.cz>
* logd: self-degrade to 'logd' user after opening pipesDaniel Golle2020-10-191-0/+8
| | | | Signed-off-by: Daniel Golle <daniel@makrotopia.org>
* logread: add option to filter for facilitiesZefir Kurtisi2019-10-221-2/+27
| | | | | | | | | | | | This adds filtering options for facilities as follows: -z <facility> handle only messages with given facility (0-23), repeatable -Z <facility> ignore messages with given facility (0-23), repeatable With that * 'logread -z 2 -z 16' will display all MAIL and LOCAL0 messages, while * 'logread -Z 2 -Z 16' will display all but MAIL and LOCAL0 messages Signed-off-by: Zefir Kurtisi <zefir.kurtisi@neratec.com>
* logread: fix reconnect logd logicJohn Crispin2018-02-141-7/+15
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* logrea: move the code setting up the request blob out of the main loopJohn Crispin2018-02-141-8/+9
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* logread: move output connection setup code out of main loopJohn Crispin2018-02-141-18/+25
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* logread: cleanup pid file handlingJohn Crispin2018-02-141-9/+11
| | | | Signed-off-by: John Crispin <john@phrozen.org>
* ubox: Replace strerror(errno) with %m format.Rosen Penev2018-02-132-4/+4
| | | | | | Saves 872 bytes on Ubuntu 16.04. No change in functionality. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ubox: Remove unnecessary memset calls.Rosen Penev2017-11-131-3/+1
| | | | | | Change to calloc instead. Less verbose. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* logd: move stripping of newlines to log_add()Felix Fietkau2017-11-061-11/+14
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logread: fix line buffer sizeFelix Fietkau2017-11-061-1/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logread: remove leftover debug codeFelix Fietkau2017-11-061-3/+1
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logd: enforce line length limit for ubus based log messages as wellFelix Fietkau2017-11-063-5/+13
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logread: use oneshot mode without -f, wait for logd to closeFelix Fietkau2017-11-061-2/+1
| | | | | | Fixes a race condition in dealing with larger amounts of log data Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logd: implement oneshot mode for stream log readFelix Fietkau2017-11-061-0/+18
| | | | | | | This will terminate the connection after all log messages have been sent. Useful for logread without follow Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logread: terminate after EOFFelix Fietkau2017-11-061-0/+6
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logd: only create pipe in stream modeFelix Fietkau2017-11-061-5/+5
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logd: use uloop instead of ustream_fd for syslogFelix Fietkau2017-11-061-26/+35
| | | | | | | Using a stream buffer for a datagram socket makes no sense. This change fixes dealing with line buffer truncation on large incoming messages Signed-off-by: Felix Fietkau <nbd@nbd.name>
* log/syslog: Add missing static to two structs.Rosen Penev2017-11-061-2/+2
| | | | | | On x86, binary size goes down by 16 bytes. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* ubox: Replace { 0 } with {}.Rosen Penev2017-11-061-1/+1
| | | | | | The latter is more compatible with older GCC versions like 4.9. Additionally, initializing with { 0 } produces a warning that only the first field was initialized. Signed-off-by: Rosen Penev <rosenp@gmail.com>
* syslog: remove unnecessary sizeof struct between messagesDan Bugnar2017-03-101-1/+1
| | | | | | | The next message needs to be written after the data of current message. This was adding "sizeof(struct log_head)" bytes between messages. Signed-off-by: Dan Bugnar <danutbug@gmail.com>
* ubox: Add an option for more accurate timestamps in logWojciech Dubowik2017-02-012-4/+21
| | | | | | | Systemwide timestamps for syslog messages with ms accuracy are usefull for debugging timing problems. Signed-off-by: Wojciech Dubowik <Wojciech.Dubowik@neratec.com>
* ubox: Fix some memory leaksRosen Penev2016-12-191-1/+1
| | | | | | Avoids leaking memory when exiting early. Signed-off by: Rosen <rosenp@gmail.com>
* logd: put non-streamed log entries into one result messageFelix Fietkau2016-09-261-2/+8
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* ubox/logd: free ubus context on exitAlexandru Ardelean2016-09-241-0/+1
| | | | Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* ubox/logd: free regex's on log_shutdown() callAlexandru Ardelean2016-09-241-0/+2
| | | | Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* logd: fix default initialization of line countFelix Fietkau2016-09-221-2/+3
| | | | Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logd: add support for sending log messages as repliesFelix Fietkau2016-09-222-25/+54
| | | | | | Useful for JSON-RPC access via uhttpd Signed-off-by: Felix Fietkau <nbd@nbd.name>
* logread: ensure that the len < sizeof(struct blob_attr) check runs before ↵Felix Fietkau2016-01-241-3/+8
| | | | | | trying to access the data Signed-off-by: Felix Fietkau <nbd@openwrt.org>
* fix gcc format security errorHauke Mehrtens2015-11-221-1/+1
| | | | Signed-off-by: Hauke Mehrtens <hauke@hauke-m.de>
* log: allow filtering messages with a regexp patternRafał Miłecki2015-07-041-2/+13
| | | | | | | This allows printing/streaming/writing messages matching a specified basic regular expression only. Signed-off-by: Rafał Miłecki <zajec5@gmail.com>
* logd: optimize notify functionLuka Perkov2015-05-141-8/+10
| | | | | | No need to construct every time the same blob_buf for each client in the list. Signed-off-by: Luka Perkov <luka@openwrt.org>
* log: make valgrind less complain by freeing allocated memoryLuka Perkov2015-05-142-1/+5
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* log: fix whitespacesLuka Perkov2015-05-142-2/+2
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* log: remove unused callbacksLuka Perkov2015-05-142-11/+0
| | | | Signed-off-by: Luka Perkov <luka@openwrt.org>
* logread: add support for non-transparent-framing for Syslog over TCPEtienne CHAMPETIER2015-03-301-4/+12
| | | | | | | | | | https://tools.ietf.org/html/rfc6587#section-3.4.2 the idea is to add \n or \0 as message trailer so it's easier to find message end v2: simplify, use \n by default, with optional \0 Signed-off-by: Etienne CHAMPETIER <champetier.etienne@gmail.com>
* properly handle return codesJohn Crispin2015-03-281-8/+9
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* properly handle return code of pipe() syscallJohn Crispin2015-03-281-1/+4
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* syslog: use appropriate levels for loggingChristian Mehlis2015-03-271-2/+2
| | | | Signed-off-by: Christian Mehlis <christian@m3hlis.de>
* RFC 3164 compliant remote loggingJohn Crispin2014-09-161-3/+6
| | | | | | | | When logread daemon send a syslog message to another host, time, severity and facility are cut off. The message contains only text. This patch adds time, severity and facility in the message as described in the RFC 3164. Signed-off-by: Belkov Max <belkov-max@mail.ru>
* ubox: exit(1) in logd if registering log object with ubus failsAlexandru Ardelean2014-08-131-1/+3
| | | | Signed-off-by: Alexandru Ardelean <ardeleanalex@gmail.com>
* log: remove superflous client_close callJohn Crispin2014-03-271-2/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* logd: fix time passed via unix fdJohn Crispin2014-03-181-1/+1
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* logd: fix internal buffer sizeJohn Crispin2014-03-123-3/+19
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* logd: fix pipe closeJohn Crispin2014-03-121-8/+2
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>
* logd: transport log data via the new ubus fd apiJohn Crispin2014-03-032-156/+150
| | | | | | this fixes the size limitation patch. Signed-off-by: John Crispin <blogic@openwrt.org>
* ubox: make logd use new ubus autoconnectJohn Crispin2014-01-221-33/+6
| | | | Signed-off-by: John Crispin <blogic@openwrt.org>