summaryrefslogtreecommitdiff
path: root/src/journal-remote/journal-remote-parse.c
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: Use correct format specifiersJan Janssen2022-08-301-1/+1
| | | | gcc will complain about all these with -Wformat-signedness.
* journal-file: merge compress/seal bool args into a single flags paramLennart Poettering2022-03-251-2/+2
| | | | | | | Just some modernization/refactoring. No change in behaviour, just let's do how we do things these days: use flags param instead of list of bools.
* journal-remote: downgrade messages about input data to warningsZbigniew Jędrzejewski-Szmek2021-05-311-1/+1
| | | | | | Those are unexpected, so a user-visible message seems appropriate. But they are not our errors, and to some extent we can recover from them, so "warning" seems more appropriate than "error".
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* journal-import: extract helpers for handling arrays of iovec and make them ↵Franck Bui2019-06-271-1/+1
| | | | available for others
* journal-remote: use source's boot-idChris Morin2019-04-021-1/+5
| | | | | | | | | | | | | systemd-journal-remote always wrote the boot-id of the device it was running on to the header of its journal files. When the source had a different boot-id (because it was generated on a different boot, or a different device), the boot-ids in the file were inconsistent. The _BOOT_ID field was that of the source, but the journal file header and each entry object header were that of the device systemd-journal-remote ran on. This breaks journalctl --list-boots on any of these files. Set the boot-id in the header to be that of the source. This also fixes the entry object headers.
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-141-3/+0
| | | | | | | perl -i -0pe 's/\s*Copyright © .... Zbigniew Jędrzejewski.*?\n/\n/gms' man/*xml git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/(#\n)?# +Copyright © [0-9, -]+ Zbigniew Jędrzejewski.*?\n//gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s*\/\*\*\*\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*?\s*\*\*\*\/\s*/\n\n/gms' git grep -e 'Copyright.*Jędrzejewski' -l | xargs perl -i -0pe 's/\s+Copyright © [0-9, -]+ Zbigniew Jędrzejewski[^\n]*//gms'
* tree-wide: beautify remaining copyright statementsLennart Poettering2018-06-141-1/+1
| | | | | | Let's unify an beautify our remaining copyright statements, with a unicode ©. This means our copyright statements are now always formatted the same way. Yay.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-141-2/+0
| | | | | | | | | | | | | | | | This part of the copyright blurb stems from the GPL use recommendations: https://www.gnu.org/licenses/gpl-howto.en.html The concept appears to originate in times where version control was per file, instead of per tree, and was a way to glue the files together. Ultimately, we nowadays don't live in that world anymore, and this information is entirely useless anyway, as people are very welcome to copy these files into any projects they like, and they shouldn't have to change bits that are part of our copyright header for that. hence, let's just get rid of this old cruft, and shorten our codebase a bit.
* journal-remote: when an entry is rejected with -EBADMSG, do not rotate the ↵Zbigniew Jędrzejewski-Szmek2018-05-311-2/+4
| | | | | | | | | | | journal file Something is wrong with the entry (probably a missing timestamp), so no point in rotating. But suppress the error in process_source(), so that the processing of the data stream continues. Also, just return 0 from writer_write() on success, the only caller doesn't care.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-061-13/+0
| | | | | | | | | | Files which are installed as-is (any .service and other unit files, .conf files, .policy files, etc), are left as is. My assumption is that SPDX identifiers are not yet that well known, so it's better to retain the extended header to avoid any doubt. I also kept any copyright lines. We can probably remove them, but it'd nice to obtain explicit acks from all involved authors before doing that.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-191-0/+1
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* journal-remote: fix memleak of the name of the remote sourceZbigniew Jędrzejewski-Szmek2017-05-191-1/+1
|
* Move export format parsing from src/journal-remote/ to src/basic/Zbigniew Jędrzejewski-Szmek2017-02-141-419/+12
| | | | No functional change.
* journal-remote : Ensure reallocation of source->buf does not result in ↵Klearchos Chaloulos2016-04-221-1/+1
| | | | | source->size < source->filled (#3086) While the function journal-remote-parse.c:get_line() enforces an assertion that source->filled <= source->size, in function journal-remote-parse.c:process_source() there is a chance that source->size will be decreased to a lower value than source->filled, when source->buf is reallocated. Therefore a check is added that ensures that source->buf is reallocated only when source->filled is smaller than target / 2.
* tree-wide: remove Emacs lines from all filesDaniel Mack2016-02-101-2/+0
| | | | | This should be handled fine now by .dir-locals.el, so need to carry that stuff in every file.
* util-lib: split out allocation calls into alloc-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split string parsing related calls from util.[ch] into parse-util.[ch]Lennart Poettering2015-10-271-0/+1
|
* util-lib: split out fd-related operations into fd-util.[ch]Lennart Poettering2015-10-251-1/+2
| | | | | There are more than enough to deserve their own .c file, hence move them over.
* util-lib: split our string related calls from util.[ch] into its own file ↵Lennart Poettering2015-10-241-1/+2
| | | | | | | | | | | | | | string-util.[ch] There are more than enough calls doing string manipulations to deserve its own files, hence do something about it. This patch also sorts the #include blocks of all files that needed to be updated, according to the sorting suggestions from CODING_STYLE. Since pretty much every file needs our string manipulation functions this effectively means that most files have sorted #include blocks now. Also touches a few unrelated include files.
* tree-wide: replace while(1) by for(;;) everywhereLennart Poettering2015-09-091-1/+1
| | | | Another Coccinelle script.
* fix gcc warnings about uninitialized variablesHarald Hoyer2015-03-271-1/+1
| | | | | | | | | | | | | like: src/shared/install.c: In function ‘unit_file_lookup_state’: src/shared/install.c:1861:16: warning: ‘r’ may be used uninitialized in this function [-Wmaybe-uninitialized] return r < 0 ? r : state; ^ src/shared/install.c:1796:13: note: ‘r’ was declared here int r; ^
* journal-remote: explain why source->buf cannot be nullZbigniew Jędrzejewski-Szmek2015-03-131-4/+9
| | | | In reference to CID #1238956.
* journal-remote: make process_data staticZbigniew Jędrzejewski-Szmek2015-03-131-1/+1
|
* journal-remote: stop using EWOULDBLOCKDavid Herrmann2015-03-131-4/+4
| | | | | There is no reason to ever use EWOULDBLOCK. It's equivalent to EAGAIN on all architectures on linux.
* journal-remote: process events without delayZbigniew Jędrzejewski-Szmek2015-03-131-0/+1
| | | | | | | | | | | | | | | | | | journal-remote buffers input, and then parses it handling one journal entry at a time. It was possible for useful data to be left in the buffer after some entries were processesed. But all data would be already read from the fd, so there would be no reason for the event loop to call the handler again. After some new data came in, the handler would be called again, and would then process the "old" data in the buffer. Fix this by enabling a handler wherever we process input data and do not exhaust data from the input buffer (i.e. when EAGAIN was not encountered). The handler runs until we encounter EAGAIN. Looping over the input data is done in this roundabout way to allow the event loop to dispatch other events in the meanwhile. If the loop was inside the handler, a source which produced data fast enough could completely monopolize the process. https://bugs.freedesktop.org/show_bug.cgi?id=89516
* journal-remote: downgrade routine messages to debugZbigniew Jędrzejewski-Szmek2015-03-131-1/+1
| | | | https://bugs.freedesktop.org/show_bug.cgi?id=89486
* journal-remote: fix saving of binary fieldsZbigniew Jędrzejewski-Szmek2015-03-021-13/+18
| | | | | | | Binary fields were not processed properly, and resulting journal files were non-conforming, resulting in an error ("Invalid field.") when reading. https://bugs.freedesktop.org/show_bug.cgi?id=89391
* Assorted format fixesZbigniew Jędrzejewski-Szmek2015-01-221-5/+5
| | | | | Types used for pids and uids in various interfaces are unpredictable. Too bad.
* treewide: use log_*_errno whenever %m is in the format stringMichal Schmidt2014-11-281-2/+2
| | | | | | | | | | | If the format string contains %m, clearly errno must have a meaningful value, so we might as well use log_*_errno to have ERRNO= logged. Using: find . -name '*.[ch]' | xargs sed -r -i -e \ 's/log_(debug|info|notice|warning|error|emergency)\((".*%m.*")/log_\1_errno(errno, \2/' Plus some whitespace, linewrap, and indent adjustments.
* treewide: more log_*_errno() conversions, multiline callsMichal Schmidt2014-11-281-2/+2
| | | | | | | | | | | | Basically: find . -name '*.[ch]' | while read f; do perl -i.mmm -e \ 'local $/; local $_=<>; s/log_(debug|info|notice|warning|error|emergency)\("([^"]*)%s"([^;]*),\s*strerror\(-?([->a-zA-Z_]+)\)\);/log_\1_errno(\4, "\2%m"\3);/gms;print;' \ $f; done Plus manual indentation fixups.
* shared/log: add log_trace as compile-time optional debuggingZbigniew Jędrzejewski-Szmek2014-10-231-3/+3
| | | | | | | | | Repetetive messages can be annoying when running with SYSTEMD_LOG_LEVEL=debug, but they are sometimes very useful when debugging problems. Add log_trace which is like log_debug but becomes a noop unless LOG_TRACE is defined during compilation. This makes it easy to enable very verbose logging for a subset of programs when compiling from source.
* journal-remote: fix counting of events writtenZbigniew Jędrzejewski-Szmek2014-09-251-3/+3
| | | | | | | | | | | After recent changes the number was always reported as 0, because the accounting was done server_destroy(), called after the message was already printed. But even before this change, the counts were wrong because seqnum start at 0 only for newly created journal files, so when appending to existing files, the calculated count was wrong anyway. Also do some variable renaming for consistency and disable some low-level debug messages.
* journal-remote: fix check if realloc failedThomas Hindoe Paaboel Andersen2014-08-311-1/+1
|
* journal-remote: avoid copying input dataZbigniew Jędrzejewski-Szmek2014-07-151-62/+71
| | | | | | Instead of copying fields into new memory allocations, simply keep pointers into the receive buffer. Data in this buffer is only copied when there is not enough space for new data and a large chunk of the buffer contains old data.
* journal-remote: rework fd and writer reference handlingZbigniew Jędrzejewski-Szmek2014-07-151-6/+37
|
* journal-remote: improve some messagesZbigniew Jędrzejewski-Szmek2014-07-151-3/+3
|
* Fix problem with allocating large buffers and log leftoversZbigniew Jędrzejewski-Szmek2014-07-151-4/+8
|
* journal-remote: allow splitting incoming logs by source hostZbigniew Jędrzejewski-Szmek2014-07-151-1/+4
| | | | | | | | | | Previously existing scheme where the file name would be based on the source was just too ugly and unpredicatable. Now there are only two options: 1. just one file (until rotation), 2. one file per source host, using the hostname as filename part. For the cases where the source is specified by the user, only option one is allowed, and the full of the file must be specified.
* journal-remote: reject fields above maximum sizeZbigniew Jędrzejewski-Szmek2014-07-151-33/+40
| | | | | | | Also fix an infinite loop on E2BIG. Remember what range we already scanned for '\n', to avoid quadratic behaviour on long "text" fields.
* Move network-related journal programs to src/journal-remote/Zbigniew Jędrzejewski-Szmek2014-07-151-0/+439
Directory src/journal has become one of the largest directories, and since systemd-journal-gatewayd, systemd-journal-remote, and forthcoming systemd-journal-upload are all closely related, create a separate directory for them.