summaryrefslogtreecommitdiffstats
path: root/src/journal-remote (follow)
Commit message (Collapse)AuthorAgeFilesLines
* tree-wide: replace for loop with FOREACH_ELEMENT or FOREACH_ARRAY macros ↵Integral2024-10-261-7/+5
| | | | (#34893)
* tree-wide: drop msg argument for DEFINE_CONFIG_PARSE() macro and friendsYu Watanabe2024-09-011-4/+1
| | | | | This makes the macros use log_syntax_parse_error(), hopefully which provides more informative log message in general, and reduces binary size.
* shared/logs-show: introduce journal_browse_prepare()Mike Yuan2024-08-223-13/+7
| | | | which combines sigbus_install() and bumping fd limit.
* journal-remote-main: pass the right error variableDavid Tardon2024-05-071-1/+1
|
* tree-wide: Use log_setup() everywhereDaan De Meyer2024-04-252-4/+2
| | | | | Otherwise the default log target is the console and we won't use the journal socket even if it is available.
* journal-gatewayd: use skip_leading_chars where appropriateMike Yuan2024-04-171-8/+5
| | | | Prompted by c5d675472588815dedf67af8c36da0fac398fb3e
* journal-gatewayd: add missing assertionsMike Yuan2024-04-171-0/+6
|
* journal-gatewayd: remove duplicate call to `startswith()`Antonio Alvarez Feijoo2024-04-171-1/+1
|
* journal-remote: fix two minor memory leaksAntonio Alvarez Feijoo2024-04-112-0/+3
|
* journal-remote: Use "event" instead of "events"Daan De Meyer2024-04-116-22/+22
| | | | We use singular "event" everywhere else, so let's use it here as well.
* journal-remote: Use sd_event_set_signal_exit()Daan De Meyer2024-04-115-60/+5
| | | | | | | This also fixes bugs in the previous code where we pass the server object as userdata to sd_event_add_signal which means that sd-event tries to use the value of the server pointer as its exit code when a signal is triggered.
* logs-show: read the current boot ID if nothing specified for add_match_boot_id()Yu Watanabe2024-03-261-9/+1
| | | | No functional change, just refactoring.
* journal-gateway: use journal_add_match_pair() and add_match_boot_id()Yu Watanabe2024-03-251-11/+3
|
* Merge pull request #30480 from keszybz/kernel-install-more-pathsZbigniew Jędrzejewski-Szmek2024-03-082-6/+12
|\ | | | | Read kernel-install config from /run/kernel too
| * various: use new config loader instead of config_parse_config_file()Zbigniew Jędrzejewski-Szmek2024-03-072-6/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This means the main config file is loaded also from /run and /usr. We should load the main config file from all the places where we load drop-ins. I realize I had a giant blind spot: I always assumed that we load config files from /etc, /run, /usr/local/lib, /usr/lib. But it turns out that we only used those paths for drop-ins. For the main config file, we only looked in /etc. The docs actually partially described this behaviour, i.e. most SYNOPSIS sections and some parts of the text, but not others. This is strange, because 6495361c7d5e8bf640841d1292ef6cfe1ea244cf was completely bogus with the behaviour before this patch. We had a huge discussion before it was merged, and clearly nobody noticed this. Similarly, in the previous version of the current pull request, we had a long discussion about the appropriate order of directories, and apparently nobody noticed that there was no order, because only looked in one directory. So the blind spot seems to have been shared. Also, systemd-analyze cat-config behaved incorrectly, i.e. its behaviour matches the new behaviour. Possibly, in the future it'll make it easier to add support for --root.
| * shared/conf-parser: collapse pkgdir and conf_file args into oneZbigniew Jędrzejewski-Szmek2024-03-072-2/+2
| | | | | | | | | | | | | | | | | | | | This essentially reverts 5656cdfeeabc16b5489f5ec7a0a36025a2ec1f23. I find it much easier to understand what is going on when the path-relative-to-the-search-path is passed in full, instead of being constructed from two parts, with one of the parts being implicit in some places. Also, we call 'systemd-analyze cat-config <path>' with <path> with the same meaning, so this makes the internal and external APIs more consistent.
* | dynamically load compression librariesMatteo Croce2024-03-051-5/+5
| | | | | | | | | | | | Dynamically load liblz4, libzstd and liblzma with dlopen(). This helps to reduce the size of the initrd image when these libraries are not really needed.
* | signal-util: imply sentinel -1 in sigprocmask_many() + sigset_add_many() ↵Lennart Poettering2024-02-232-2/+2
|/ | | | args list
* journal-remote: allow AF_VSOCK and AF_UNIX for --listen-rawSam Leonard2024-02-151-1/+3
| | | | | This allows log messages forwarded over an AF_UNIX or AF_VSOCK socket by journald to be received by systemd-journal-remote.
* journal-file-util: drop unused template argument for ↵Yu Watanabe2024-02-151-1/+0
| | | | | | | | | journal_file_open_reliably() I understand that the original motivation to introduce the template argument here is to make journal_file_open() and _reliabrly() take the same arguments. But, yeah, that's completely unused, not necessary to complicate the code even the difference is not big.
* tree-wide: set SD_JOURNAL_ASSUME_IMMUTABLE where appropriateYu Watanabe2024-02-112-2/+2
| | | | Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
* journal-remote: use macro wrapper instead of alloca to extend stringZbigniew Jędrzejewski-Szmek2024-01-152-35/+38
| | | | | | | | | | | | | | | | | | | | | | | | | | | We would use alloca to extend the format string with "\n". We do this automatically in order to not forget appending the newline everywhere. We can simplify the whole thing by using a macro to append the newline instead, which means that we don't need to copy the string. Because we concatenate the string argument with another literal string, we know it must a literal string. Thus it's not a problem that it is "evaluated" two times. Quoting Hristo Venev: > Since commit f5e757f1ce84c1d6ae932cf2b604238fb4cedc00, mhd_respond() adds a > newline to its argument before passing it on to mhd_respond_internal(). This > is done via an alloca()-allocated buffer. However, MHD_RESPMEM_PERSISTENT is > given as a flag to MHD_create_response_from_buffer(), leading to a > use-after-free later when the response is sent. Replacing > MHD_RESPMEM_PERSISTENT with MHD_RESPMEM_MUST_COPY appears to fix the issue. MHD_RESPMEM_MUST_COPY would work, but we also use mhd_respond() for mhd_oom(), and we don't want to allocate in an oom scenario in order to maximize the possibility that an answer will be delivered. Using the macro magic makes this nicer and we get rid of the code doing alloca. Fixes an issue reported by Hristo Venev. Fixes https://github.com/systemd/systemd/issues/9858.
* socket-util: modernize socknameinfo_pretty() a bitLennart Poettering2024-01-091-1/+1
|
* tree-wide: shorten a couple of ternary expressionsFrantisek Sumsal2023-12-251-1/+1
|
* journal-remote: set upper length bound when parsing incoming headersLuca Boccassi2023-12-093-1/+10
| | | | CID#1529420
* journal-gatewayd: add since/until parameters for /entriesSamuel BF2023-12-061-40/+136
| | | | | | | Request with Range header like 'entries=<cursor>:' (with a colon at the end, invalid syntax per the doc), is now rejected with error 400 Bad Request. fix #4883
* process-util: add new FORK_DEATHSIG_SIGKILL flag, rename FORK_DEATHSIG → ↵Lennart Poettering2023-11-021-1/+1
| | | | | | | | | | | | | | | | | | FORK_DEATHSIG_SIGTERM Sometimes it makes sense to hard kill a client if we die. Let's hence add a third FORK_DEATHSIG flag for this purpose: FORK_DEATHSIG_SIGKILL. To make things less confusing this also renames FORK_DEATHSIG to FORK_DEATHSIG_SIGTERM to make clear it sends SIGTERM. We already had FORK_DEATHSIG_SIGINT, hence this makes things nicely symmetric. A bunch of users are switched over for FORK_DEATHSIG_SIGKILL where we know it's safe to abort things abruptly. This should make some kernel cases more robust, since we cannot get confused by signal masks or such. While we are at it, also fix a bunch of bugs where we didn't take FORK_DEATHSIG_SIGINT into account in safe_fork()
* tree-wide: check if return value of lseek() and friends is negativeYu Watanabe2023-10-191-2/+2
| | | | | | | | | We usually check return value of syscalls or glibc functions by it is negative or not, something like that `if (stat(path, &st) < 0)`. Let's also use the same style for lseek() and friends even the type of their return value is off_t. Note, fseeko() returns int, instead of off_t.
* fuzz: unify logging setupFrantisek Sumsal2023-10-191-2/+1
| | | | | | | | | | Make sure we don't log anything when running in "fuzzing" mode. Also, when at it, unify the setup logic into a helper, pretty similar to the test_setup_logging() one. Addresses: - https://github.com/systemd/systemd/pull/29558#pullrequestreview-1676060607 - https://github.com/systemd/systemd/pull/29558#discussion_r1358940663
* meson: add build option for install path of main config filesFranck Bui2023-10-171-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This allows distros to install configuration file templates in /usr/lib/systemd for example. Currently we install "empty" config files in /etc/systemd/. They serve two purposes: - The file contains commented-out values that show the default settings. - It is easier to edit the right file if it is already there, the user doesn't have to type in the path correctly, and the basic file structure is already in place so it's easier to edit. Things that have happened since this approach was put in place: - We started supporting drop-ins for config files, and drop-ins are the recommended way to create local configuration overrides. - We have systemd-analyze cat-config which takes care of iterating over all possible locations (/etc, /run, /usr, /usr/local) and figuring out the right file. - Because of the first two points, systemd-analyze cat-config is much better, because it takes care of finding all the drop-ins and figuring out the precedence. Looking at files manually is still possible of course, but not very convenient. The disadvantages of the current approach with "empty" files in /etc: - We clutter up /etc so it's harder to see what the local configuration actually is. - If a user edits the file, package updates will not override the file (e.g. systemd.rpm uses %config(noreplace). This means that the "documented defaults" will become stale over time, if the user ever edits the main config file. Thus, I think that it's reasonable to: - Install the main config file to /usr/lib so that it serves as reference for syntax and option names and default values and is properly updated on package upgrades. - Recommend to users to always use drop-ins for configuration and systemd-analyze cat-config to view the documentation. This setting makes this change opt-in. Fixes #18420. [zjs: add more text to the description]
* Merge pull request #29242 from fbuihuu/update-main-config-file-headersZbigniew Jędrzejewski-Szmek2023-10-172-6/+10
|\ | | | | config files: update their header to reflect that they can be install…
| * config files: update their header to reflect that they can be installed in /usrFranck Bui2023-09-212-6/+10
| | | | | | | | Follow-up for c76f2fb0e59340222ce21f85c17d384c114db9de.
* | tree-wide: add missing sigbus handlingYu Watanabe2023-10-071-0/+3
| |
* | journal-remote: drop dependencies to journaldYu Watanabe2023-10-023-6/+1
| | | | | | | | Now journal-remote can be built without libjournal_core.
* | journald: move and rename journal/managed-journal-file.[ch] -> ↵Yu Watanabe2023-10-023-2/+3
| | | | | | | | | | | | | | shared/journal-file-util.[ch] The files are used by both journald and journal-remote. Let's move them to src/shared.
* | journald: drop ManagedJournalFileYu Watanabe2023-10-023-14/+14
| | | | | | | | | | The ManagedJournalFile object is a trivial wrapper of JournalFile. Let's drop it, and also drop 'managed_' prefix from the functions.
* | journald: split-out closing journal files from managed_journal_file_open()Yu Watanabe2023-10-021-1/+0
| | | | | | | | | | No functional change, just refactoring and preparation for later commits.
* | meson: do not explicitly specify ownership of /var/log/journal/Zbigniew Jędrzejewski-Szmek2023-09-211-1/+1
|/ | | | | | | | | | | | | | | | | | | | In 9289e093ae6fd5484f9119e1ee07d1dffe37cd10 we started using install_emptydir(). When running unprivileged, 'DESTDIR=… meson install -C build --quiet --no-rebuild' would emit two warnings: '…/var/log/journal': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring... '…/var/log/journal/remote': Unable to set owner 'root' and group 'root': Operation not permitted, ignoring... Those were the only two install_emptydir()s that specified ownership. Let's drop the user/group specification to get rid of the warning. When installing as root, we will create a root-owned directory anyway. When not running as root, we cannot create a root-owned directory. So this specification only makes a difference if we are running as root, and the directory already existed, and was not owned by root. In that case, I think it's actually better to leave the existing modification in place. (E.g. maybe the admin chgrp'ed the ownership for whatever reason. We might just as well leave that in place.)
* config files: more recommendations of `systemd-analyze cat-config`Franck Bui2023-09-192-0/+4
| | | | Follow-up for 3b0754b16c5.
* iovec-util: add iovw_isempty() helperLennart Poettering2023-08-111-2/+1
| | | | Follow-up for: 3746131aac4798cacf67b60cfc4e2e1c80ec4efb
* meson: use install_emptydir() and drop meson-make-symlink.shYu Watanabe2023-08-081-5/+2
| | | | | | The script is mostly equivalent to 'mkdir -p' and 'ln -sfr'. Let's replace it with install_emptydir() builtin function and inline meson call.
* meson: also merge declarations of fuzzers with other executablesYu Watanabe2023-08-031-13/+8
|
* meson: move declarations of journal-remote and friendsYu Watanabe2023-08-011-0/+46
|
* journal-upload: add missing assertionYu Watanabe2023-07-051-0/+2
|
* journal-upload: replace deprecated sd_journal_open_container()Yu Watanabe2023-07-051-7/+4
|
* journal-upload: make --namespace=* workYu Watanabe2023-07-051-5/+3
| | | | | | | Follow-up for 9f6e0bd417fa287dd1e7b541bfe0c60f04cc29e4. Note that sd_journal_open() is a simple wrapper of sd_journal_open_namespace(), hence we can merge the two branch.
* journal-remote: upload journals from namespaceIgor Tsiglyar2023-07-041-1/+26
|
* journal-remote: fix syntax in error messageZbigniew Jędrzejewski-Szmek2023-06-231-1/+1
| | | | Prompted by 2411e990a480affe30bd99a2a33ab6b94a3fe5dd.
* journal-remote: fix typo in an error messageFrantisek Sumsal2023-06-211-1/+1
|
* journal-upload: capitalize all error messagesFrantisek Sumsal2023-06-191-10/+10
| | | | To make them consistent throughout the file.