summaryrefslogtreecommitdiff
path: root/src/journal-remote
Commit message (Collapse)AuthorAgeFilesLines
* Drop my copyright headersZbigniew Jędrzejewski-Szmek2018-06-1411-36/+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-1411-11/+11
| | | | | | 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: remove Lennart's copyright linesLennart Poettering2018-06-142-4/+0
| | | | | | | | | | | These lines are generally out-of-date, incomplete and unnecessary. With SPDX and git repository much more accurate and fine grained information about licensing and authorship is available, hence let's drop the per-file copyright notice. Of course, removing copyright lines of others is problematic, hence this commit only removes my own lines and leaves all others untouched. It might be nicer if sooner or later those could go away too, making git the only and accurate source of authorship information.
* tree-wide: drop 'This file is part of systemd' blurbLennart Poettering2018-06-1411-22/+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: do not send _BOOT_ID twiceZbigniew Jędrzejewski-Szmek2018-05-311-3/+9
| | | | | | | | | | | | Also remove the comma from the comment everywhere, I think the comma unnecessarilly put emphasis on the clause after the comma. Fixes #9090. Reproducer: systemd-journal-remote --split-mode=none -o /tmp/msg6.journal --trust=all --listen-http=8080 systemd-journal-upload -u http://localhost:8080 journalctl --file /tmp/msg6.journal -o verbose -n1
* journal: allow boot_id to be passed to journal_append_entry()Zbigniew Jędrzejewski-Szmek2018-05-311-2/+4
| | | | | In this commit, this is done only in testing code, i.e. there is no functional change apart from tests.
* journal-remote: when an entry is rejected with -EBADMSG, do not rotate the ↵Zbigniew Jędrzejewski-Szmek2018-05-312-5/+8
| | | | | | | | | | | 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.
* journal: rename output_journal to show_journal_entryZbigniew Jędrzejewski-Szmek2018-05-311-1/+1
| | | | | We have show_journal, and output_journal, and it's not immediately clear how they related. Rename the first to show that it just prints one entry.
* fuzz-journal-remote: allow fuzzer to be built without µhttpdZbigniew Jędrzejewski-Szmek2018-05-313-9/+26
| | | | | journal-remote still requires µhttpd, but things are easier if the fuzzer can be built without.
* log-generator: make message size configurable, add short optionsZbigniew Jędrzejewski-Szmek2018-05-311-2/+5
| | | | Also remove "b''" from the generated MESSAGE= field.
* journal-remote: export handle_raw_source()Zbigniew Jędrzejewski-Szmek2018-05-312-7/+13
|
* journal-remote: split out µhttpd support and main() into a separate fileZbigniew Jędrzejewski-Szmek2018-05-314-1161/+1240
| | | | | | | | | | | | | This is in preparation to reusing the RemoteServer in other concepts. I tried to keep changes to minimum: - arg_* global variables are now passed as state in RemoteServer - exported functions get the "journal_remote_" prefix - some variables are renamed In particular, there is an ugly global RemoveServer* variable. It was originally added because µhttpd did not allow state to be passed to the callbacks. I'm not sure if this has been remediated in µhttpd, but either way, this is not changed here, the global variable is only renamed for clarity.
* os-util: add helpers for finding /etc/os-releaseLennart Poettering2018-05-241-4/+3
| | | | | Place this new helpers in a new source file os-util.[ch], and move the existing and related call path_is_os_tree() to it as well.
* fileio: accept FILE* in addition to path in parse_env_file()Lennart Poettering2018-05-242-3/+3
| | | | | | | Most our other parsing functions do this, let's do this here too, internally we accept that anyway. Also, the closely related load_env_file() and load_env_file_pairs() also do this, so let's be systematic.
* tree-wide: drop redundant _cleanup_ macros (#8810)Lennart Poettering2018-04-252-4/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | This drops a good number of type-specific _cleanup_ macros, and patches all users to just use the generic ones. In most recent code we abstained from defining type-specific macros, and this basically removes all those added already, with the exception of the really low-level ones. Having explicit macros for this is not too useful, as the expression without the extra macro is generally just 2ch wider. We should generally emphesize generic code, unless there are really good reasons for specific code, hence let's follow this in this case too. Note that _cleanup_free_ and similar really low-level, libc'ish, Linux API'ish macros continue to be defined, only the really high-level OO ones are dropped. From now on this should really be the rule: for really low-level stuff, such as memory allocation, fd handling and so one, go ahead and define explicit per-type macros, but for high-level, specific program code, just use the generic _cleanup_() macro directly, in order to keep things simple and as readable as possible for the uninitiated. Note that before this patch some of the APIs (notable libudev ones) were already used with the high-level macros at some places and with the generic _cleanup_ macro at others. With this patch we hence unify on the latter.
* tree-wide: drop spurious newlines (#8764)Lennart Poettering2018-04-194-6/+0
| | | | | | | | Double newlines (i.e. one empty lines) are great to structure code. But let's avoid triple newlines (i.e. two empty lines), quadruple newlines, quintuple newlines, …, that's just spurious whitespace. It's an easy way to drop 121 lines of code, and keeps the coding style of our sources a bit tigther.
* tree-wide: drop license boilerplateZbigniew Jędrzejewski-Szmek2018-04-0612-156/+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.
* tree-wide: use TAKE_PTR() and TAKE_FD() macrosYu Watanabe2018-04-052-6/+4
|
* journal: provide compress_threshold_bytes parameterAlex Gartrell2018-03-202-3/+3
| | | | | | Previously the compression threshold was hardcoded to 512, which meant that smaller values wouldn't be compressed. This left some storage savings on the table, so instead, we make that number tunable.
* meson: use triple-quote delimition in one more placeZbigniew Jędrzejewski-Szmek2018-03-091-2/+2
|
* tree-wide: port various places over to use new rearrange_stdio()Lennart Poettering2018-03-021-7/+4
|
* journal-upload: make use of safe_close() where appropriateLennart Poettering2018-02-261-3/+1
|
* Merge pull request #7881 from keszybz/pcreLennart Poettering2018-01-281-1/+2
|\ | | | | Add new --grep option to journalctl
| * journalctl: add highlighting for matched substringZbigniew Jędrzejewski-Szmek2018-01-281-1/+2
| | | | | | | | | | | | | | | | | | Red is used for highligting, the same as grep does. Except when the line is highlighted red already, because it has high priority, in which case plain ansi highlight is used for the matched substring. Coloring is implemented for short and cat outputs, and not for other types. I guess we could also add it for verbose output in the future.
* | log: minimize includes in log.hLennart Poettering2018-01-112-0/+2
|/ | | | | | | | | | | | | | | | | | | | | | | | | | log.h really should only include the bare minimum of other headers, as it is really pulled into pretty much everything else and already in itself one of the most basic pieces of code we have. Let's hence drop inclusion of: 1. sd-id128.h because it's entirely unneeded in current log.h 2. errno.h, dito. 3. sys/signalfd.h which we can replace by a simple struct forward declaration 4. process-util.h which was needed for getpid_cached() which we now hide in a funciton log_emergency_level() instead, which nicely abstracts the details away. 5. sys/socket.h which was needed for struct iovec, but a simple struct forward declaration suffices for that too. Ultimately this actually makes our source tree larger (since users of the functionality above must now include it themselves, log.h won't do that for them), but I think it helps to untangle our web of includes a tiny bit. (Background: I'd like to isolate the generic bits of src/basic/ enough so that we can do a git submodule import into casync for it)
* process-util: add another fork_safe() flag for enabling LOG_ERR/LOG_WARN loggingLennart Poettering2018-01-041-2/+2
|
* tree-wide: introduce new safe_fork() helper and port everything overLennart Poettering2017-12-251-22/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | This adds a new safe_fork() wrapper around fork() and makes use of it everywhere. The new wrapper does a couple of things we previously did manually and separately in a safer, more correct and automatic way: 1. Optionally resets signal handlers/mask in the child 2. Sets a name on all processes we fork off right after forking off (and the patch assigns useful names for all processes we fork off now, following a systematic naming scheme: always enclosed in () – in order to indicate that these are not proper, exec()ed processes, but only forked off children, and if the process is long-running with only our own code, without execve()'ing something else, it gets am "sd-" prefix.) 3. Optionally closes all file descriptors in the child 4. Optionally sets a PR_SET_DEATHSIG to SIGTERM in the child, in a safe way so that the parent dying before this happens being handled safely. 5. Optionally reopens the logs 6. Optionally connects stdin/stdout/stderr to /dev/null 7. Debug logs about the forked off processes.
* tree-wide: add DEBUG_LOGGING macro that checks whether debug logging is on ↵Lennart Poettering2017-12-151-1/+1
| | | | | | | (#7645) This makes things a bit easier to read I think, and also makes sure we always use the _unlikely_ wrapper around it, which so far we used sometimes and other times we didn't. Let's clean that up.
* tree-wide: make use of new STRLEN() macro everywhere (#7639)Lennart Poettering2017-12-141-1/+1
| | | | | Let's employ coccinelle to do this for us. Follow-up for #7625.
* journal-upload: remove duplication of --help and --version in help textMarcus Folkesson2017-12-031-2/+0
| | | | Signed-off-by: Marcus Folkesson <marcus.folkesson@gmail.com>
* journal-remote: add helper function and use hashmap_free_with_destructorZbigniew Jędrzejewski-Szmek2017-11-281-9/+8
|
* tree-wide: adjust fall through comments so that gcc is happyShawn Landden2017-11-201-12/+12
| | | | | | | | Distcc removes comments, making the comment silencing not work. I know there was a decision against a macro in commit ec251fe7d5bc24b5d38b0853bc5969f3a0ba06e2
* Add license headers and SPDX identifiers to meson.build filesZbigniew Jędrzejewski-Szmek2017-11-191-0/+17
| | | | | | | So far I avoided adding license headers to meson files, but they are pretty big and important and should carry license headers like everything else. I added my own copyright, even though other people modified those files too. But this is mostly symbolic, so I hope that's OK.
* Add SPDX license identifiers to source files under the LGPLZbigniew Jędrzejewski-Szmek2017-11-1911-0/+11
| | | | | This follows what the kernel is doing, c.f. https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=5fd54ace4721fc5ce2bb5aef6318fcf17f421460.
* conf-parser: turn three bool function params into a flags fieldsLennart Poettering2017-11-132-2/+2
| | | | | This makes things more readable and fixes some issues with incorrect flag propagation between the various flavours of config_parse().
* Reverting erroneous changes made of the course of adding a timeout to ↵martingh2017-11-011-8/+2
| | | | journal-remote event handling (#7219)
* journal-remote: set description to timer_event (#7234)Yu Watanabe2017-11-011-1/+1
| | | Follow-up for 5e38eb931f9207f577e7e8b752be5a522e5f9b87.
* journalctl: add --output-fields= (#7181)Lars Karlitski2017-10-271-1/+1
| | | | | | | | | This option allows restricting the shown fields in the output modes that would normally show all fields. It allows clients that are only interested in a subset of the fields to access those more efficiently. Also, it makes the resulting size of the output more predictable. It has no effect on the various `short` output modes, because those already only show a subset of the fields.
* Adding timer_event to wakeup as suggested by MHD_get_timeout (#7152)martingh2017-10-262-6/+51
|
* build-sys: use #if Y instead of #ifdef Y everywhereZbigniew Jędrzejewski-Szmek2017-10-044-7/+7
| | | | | | | | | | | | | | | The advantage is that is the name is mispellt, cpp will warn us. $ git grep -Ee "conf.set\('(HAVE|ENABLE)_" -l|xargs sed -r -i "s/conf.set\('(HAVE|ENABLE)_/conf.set10('\1_/" $ git grep -Ee '#ifn?def (HAVE|ENABLE)' -l|xargs sed -r -i 's/#ifdef (HAVE|ENABLE)/#if \1/; s/#ifndef (HAVE|ENABLE)/#if ! \1/;' $ git grep -Ee 'if.*defined\(HAVE' -l|xargs sed -i -r 's/defined\((HAVE_[A-Z0-9_]*)\)/\1/g' $ git grep -Ee 'if.*defined\(ENABLE' -l|xargs sed -i -r 's/defined\((ENABLE_[A-Z0-9_]*)\)/\1/g' + manual changes to meson.build squash! build-sys: use #if Y instead of #ifdef Y everywhere v2: - fix incorrect setting of HAVE_LIBIDN2
* journal-remote: show error if SplitMode=host with 'active' source is specifiedYu Watanabe2017-08-301-1/+9
|
* journal-remote: show error message if output file name does not end with ↵Yu Watanabe2017-08-271-4/+9
| | | | | | | | | | | | | | | .journal `journalctl -o export | systemd-journal-remote -o /tmp/dir -` gives the following error messages. ``` Failed to open output journal /tmp/dir: Invalid argument Failed to get writer for source stdin: Invalid argument Failed to create source for fd:0 (stdin): Invalid argument ``` And these are hard to understand what is the problem. This commit makes journal-remote check whether the output file name ends with .journal suffix or not, and if not, output error message.
* microhttpd-util: add commentYu Watanabe2017-08-072-7/+15
|
* journal-remote: remove MHD_USE_PEDANTIC_CHECKS from the default flagsYu Watanabe2017-08-061-1/+0
| | | | Follow-up for 010585873454d07625ee962ffa2ef2823624bfbe.
* journal-remote: use MHD_OPTION_STRICT_FOR_CLIENT if MHD_USE_PEDANTIC_CHECKS ↵Yu Watanabe2017-07-281-0/+10
| | | | | | | | is deprecated The option MHD_OPTION_STRICT_FOR_CLIENT is provided since libmicrohttpd-0.9.54, and MHD_USE_PEDANTIC_CHECKS will be deprecated in future. This makes support both option.
* journal-gateway: use MHD_USE_POLL_INTERNAL_THREAD instead of MHD_USE_POLLYu Watanabe2017-07-282-1/+6
| | | | | | | | | | | | | | | The option MHD_USE_THREAD_PER_CONNECTION requires MHD_USE_POLL_INTERNAL_THREAD since libmicrohttpd-0.9.53. If MHD_USE_POLL is used instead of MHD_USE_POLL_INTERNAL_THREAD, then the library outputs the following warning: ``` Warning: MHD_USE_THREAD_PER_CONNECTION must be used only with MHD_USE_INTERNAL_POLLING_THREAD. Flag MHD_USE_INTERNAL_POLLING_THREAD was added. Consider setting MHD_USE_INTERNAL_POLLING_THREAD explicitly. ``` The option MHD_USE_POLL_INTERNAL_THREAD is defined as `MHD_USE_POLL_INTERNAL_THREAD = MHD_USE_POLL | MHD_USE_INTERNAL_POLLING_THREAD,` So, let's use MHD_USE_POLL_INTERNAL_THREAD instead of MHD_USE_POLL.
* journal-remote,gateway: use MHD_USE_TLS instead of MHD_USE_SSLYu Watanabe2017-07-283-3/+8
| | | | The option is renamed in libmicrohttpd-0.9.52.
* tree-wide: make use of getpid_cached() wherever we canLennart Poettering2017-07-202-3/+3
| | | | | | | This moves pretty much all uses of getpid() over to getpid_raw(). I didn't specifically check whether the optimization is worth it for each replacement, but in order to keep things simple and systematic I switched over everything at once.
* build-sys: drop gitignore patterns for in-tree buildsZbigniew Jędrzejewski-Szmek2017-07-181-2/+0
| | | | ... and other autotools-generated files.
* build-sys: drop automake supportZbigniew Jędrzejewski-Szmek2017-07-181-1/+0
| | | | | v2: - also mention m4