summaryrefslogtreecommitdiffstats
path: root/src/journal-remote/journal-upload.c (follow)
Commit message (Collapse)AuthorAgeFilesLines
* shared/logs-show: introduce journal_browse_prepare()Mike Yuan2024-08-221-5/+2
| | | | which combines sigbus_install() and bumping fd limit.
* tree-wide: Use log_setup() everywhereDaan De Meyer2024-04-251-2/+1
| | | | | Otherwise the default log target is the console and we won't use the journal socket even if it is available.
* journal-remote: fix two minor memory leaksAntonio Alvarez Feijoo2024-04-111-0/+2
|
* journal-remote: Use "event" instead of "events"Daan De Meyer2024-04-111-7/+7
| | | | 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-111-36/+2
| | | | | | | 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.
* Merge pull request #30480 from keszybz/kernel-install-more-pathsZbigniew Jędrzejewski-Szmek2024-03-081-3/+6
|\ | | | | Read kernel-install config from /run/kernel too
| * various: use new config loader instead of config_parse_config_file()Zbigniew Jędrzejewski-Szmek2024-03-071-3/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | 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-071-1/+1
| | | | | | | | | | | | | | | | | | | | 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.
* | signal-util: imply sentinel -1 in sigprocmask_many() + sigset_add_many() ↵Lennart Poettering2024-02-231-1/+1
|/ | | | args list
* tree-wide: set SD_JOURNAL_ASSUME_IMMUTABLE where appropriateYu Watanabe2024-02-111-1/+1
| | | | Co-authored-by: Costa Tsaousis <costa@netdata.cloud>
* 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-upload: capitalize all error messagesFrantisek Sumsal2023-06-191-10/+10
| | | | To make them consistent throughout the file.
* journal-remote: sync TrustedCertificateFile= parsing with journal-uploadFrantisek Sumsal2023-06-191-39/+0
| | | | | So we can use TrustedCertificateFile=- to disable certificate checking for both utilities.
* journal-upload: use mfree()David Tardon2023-05-241-2/+1
|
* tree-wide: simplify x ? x : y to x ?: y where applicableFrantisek Sumsal2023-03-181-1/+1
|
* conf: replace config_parse_many_nulstr() with config_parse_config_file()Franck Bui2023-03-131-8/+3
| | | | | | | | | | | | | | | | | All daemons use a similar scheme to read their main config files and theirs drop-ins. The main config files are always stored in /etc/systemd directory and it's easy enough to construct the name of the drop-in directories based on the name of the main config file. Hence the new helper does that internally, which allows to reduce and simplify the args passed previously to config_parse_many_nulstr(). Besides the overall code simplification it results: 16 files changed, 87 insertions(+), 159 deletions(-) it allows to identify clearly the locations in the code where configuration files are parsed.
* tree-wide: use unlink_and_freep() moreoverLennart Poettering2023-02-231-4/+3
|
* Rename def.h to constants.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
| | | | | | The name "def.h" originates from before the rule of "no needless abbreviations" was established. Let's rename the file to clarify that it contains a collection of various semi-related constants.
* basic: move version() to build.h+cZbigniew Jędrzejewski-Szmek2022-11-081-1/+1
|
* tree-wide: use ASSERT_PTR moreDavid Tardon2022-09-131-12/+5
|
* Move path_simplify_and_warn() to new shared/parse-helpers.cZbigniew Jędrzejewski-Szmek2022-04-071-2/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This is a high-level function, and it belongs in libsystemd-shared. This way we don't end up linking a separate copy into various binaries. It would even end up in libsystemd, where it is not needed. (Maybe it'd be removed in some optimization phase, but it's better to not rely on that.) $ grep -l -r -a 'path is not absolute%s' build/ build/libnss_systemd.so.2 build/pam_systemd_home.so build/test-dlopen build/src/basic/libbasic.a.p/path-util.c.o build/src/basic/libbasic.a build/src/shared/libsystemd-shared-249.so build/test-bus-error build/libnss_mymachines.so.2 build/pam_systemd.so build/libnss_resolve.so.2 build/libnss_myhostname.so.2 build/libsystemd.so.0.32.0 build/libudev.so.1.7.2 $ grep -l -r -a 'path is not absolute%s' build/ build/src/shared/libsystemd-shared-251.a.p/parse-helpers.c.o build/src/shared/libsystemd-shared-251.a build/src/shared/libsystemd-shared-251.so No functional change.
* tree-wide: add a space after if, switch, for, and whileYu Watanabe2022-04-011-1/+1
|
* conf-parser: merge config_parse_string() and config_parse_safe_string()Yu Watanabe2022-03-101-5/+5
| | | | | This also makes unsafe strings escaped when logged. Otherwise, journalctl may not show the log message unless '--all' is specified.
* tree-wide: use config_parse_safe_string() at various placesLennart Poettering2022-02-091-1/+1
|
* alloc-util: add strdupa_safe() + strndupa_safe() and use it everywhereLennart Poettering2021-10-141-1/+1
| | | | | | | | | | | | | Let's define two helpers strdupa_safe() + strndupa_safe() which do the same as their non-safe counterparts, except that they abort if called with allocations larger than ALLOCA_MAX. This should ensure that all our alloca() based allocations are subject to this limit. afaics glibc offers three alloca() based APIs: alloca() itself, strndupa() + strdupa(). With this we have now replacements for all of them, that take the limit into account.
* variuos: add missing includesZbigniew Jędrzejewski-Szmek2021-09-221-0/+1
|
* tree-wide: mark set-but-not-used variables as unused to make LLVM happyFrantisek Sumsal2021-09-151-1/+1
| | | | | | | | | | | | | | LLVM 13 introduced `-Wunused-but-set-variable` diagnostic flag, which trips over some intentionally set-but-not-used variables or variables attached to cleanup handlers with side effects (`_cleanup_umask_`, `_cleanup_(notify_on_cleanup)`, `_cleanup_(restore_sigsetp)`, etc.): ``` ../src/basic/process-util.c:1257:46: error: variable 'saved_ssp' set but not used [-Werror,-Wunused-but-set-variable] _cleanup_(restore_sigsetp) sigset_t *saved_ssp = NULL; ^ 1 error generated. ```
* Drop the text argument from assert_not_reached()Zbigniew Jędrzejewski-Szmek2021-08-031-1/+1
| | | | | | | | | | | | | | | | | In general we almost never hit those asserts in production code, so users see them very rarely, if ever. But either way, we just need something that users can pass to the developers. We have quite a few of those asserts, and some have fairly nice messages, but many are like "WTF?" or "???" or "unexpected something". The error that is printed includes the file location, and function name. In almost all functions there's at most one assert, so the function name alone is enough to identify the failure for a developer. So we don't get much extra from the message, and we might just as well drop them. Dropping them makes our code a tiny bit smaller, and most importantly, improves development experience by making it easy to insert such an assert in the code without thinking how to phrase the argument.
* Add a network timeout option to journal-uploadJayanth Ananthapadmanaban2021-06-141-4/+12
|
* Wider range of options for selecting entries for systemd-journal-gatewaydSamuel BF2021-05-101-1/+1
| | | | | Introducing --user, --system, --merge and --file flags, like for journalctl and systemd-journal-upload.
* meson: simplify the BUILD_MODE conditionalZbigniew Jędrzejewski-Szmek2021-04-141-1/+1
| | | | | | | Using a enum is all nice and generic, but at this point it seems unlikely that we'll add further build modes. But having an enum means that we need to include the header file with the enumeration whenerever the conditional is used. I want to use the conditional in log.h, which makes it hard to avoid circular imports.
* journal-upload: use _cleanup_ for curl_slistDavid Tardon2021-03-181-8/+6
|
* journal-upload: make the curl_slist cleanup actually workDavid Tardon2021-03-181-5/+7
| | | | If h is NULL, it is pointless to call curl_slist_free_all() on it...
* journal-upload: cleanup CURL* on errorDavid Tardon2021-03-181-2/+4
|
* journal-remote: convert to parse_boolean_argument() and fix type confusionZbigniew Jędrzejewski-Szmek2021-02-171-12/+7
| | | | | | | | | We were passing a reference to 'int arg_seal' to config_parse_bool(), which expects a 'bool *'. Luckily, this would work, because 'bool' is smaller than 'int', so config_parse_bool() would set the least-significant byte of arg_seal. At least I think so. But let's use consistent types ;) Also, modernize style a bit and don't use integers in boolean context.
* Add comma in structured initialization in a few placesZbigniew Jędrzejewski-Szmek2021-02-101-1/+1
| | | | It just looks nicer…
* log: make tools also read the kernel command line when run as a serviceYu Watanabe2021-01-311-1/+1
| | | | | | | | This effectively reverts 41d1f469cf10f5f3e9cb4f4853ace9b0cfe5beae. Before this, e.g., `networkctl reload` invoked by `systemctl reload systemd-networkd.service` does not produce debugging logs even if systemd.log-level=debug is set. This fixes the issue.
* tree-wide: Drop custom formatting for print() help messagesDaan De Meyer2021-01-311-4/+3
| | | | | | | | | | | | I think this formatting was originally used because it simplified adding new options to the help messages. However, these days, most tools their help message end with "\nSee the %s for details.\n" so the final line almost never has to be edited which eliminates the benefit of the custom formatting used for printf() help messages. Let's make things more consistent and use the same formatting for printf() help messages that we use everywhere else. Prompted by https://github.com/systemd/systemd/pull/18355#discussion_r567241580
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* various daemons: emit Stopping... notification before destructing the ↵Zbigniew Jędrzejewski-Szmek2020-07-021-1/+1
| | | | | | | | manager object This is mostly cosmetic, but let's reorder the destructors so that we do the final sd_notify() call before we run the destructor for the manager object.
* log: introduce log_parse_environment_cli() and log_setup_cli()Filipe Brandenburger2020-06-241-1/+1
| | | | | | | | | | | | | | | | Presently, CLI utilities such as systemctl will check whether they have a tty attached or not to decide whether to parse /proc/cmdline or EFI variable SystemdOptions looking for systemd.log_* entries. But this check will be misleading if these tools are being launched by a daemon, such as a monitoring daemon or automation service that runs in background. Make log handling of CLI tools uniform by never checking /proc/cmdline or EFI variables to determine the logging level. Furthermore, introduce a new log_setup_cli() shortcut to set up common options used by most command-line utilities.
* conf-parser: return mtime in config_parse() and friendsLennart Poettering2020-06-021-5/+10
| | | | | | | | | | | | | This is a follow-up for 9f83091e3cceb646a66fa9df89de6d9a77c21d86. Instead of reading the mtime off the configuration files after reading, let's do so before reading, but with the fd we read the data from. This is not only cleaner (as it allows us to save one stat()), but also has the benefit that we'll detect changes that happen while we read the files. This also reworks unit file drop-ins to use the common code for determining drop-in mtime, instead of reading system clock for that.
* journalctl,elsewhere: make sure --file=foo fails with sane error msg if foo ↵Lennart Poettering2020-05-191-1/+1
| | | | | | | | | | | | | is not readable It annoyed me for quite a while that running "journalctl --file=…" on a file that is not readable failed with a "File not found" error instead of a permission error. Let's fix that. We make this work by using the GLOB_NOCHECK flag for glob() which means that files are not accessible will be returned in the array as they are instead of being filtered away. This then means that our later attemps to open the files will fail cleanly with a good error message.
* Support journal-upload HTTPS without key and certificateCiprian Hacman2020-04-161-6/+47
|
* journal: properly mark two definitions that are deprecated with GCC ↵Lennart Poettering2020-01-311-2/+6
| | | | attributes for that
* tree-wide: (void)ify a few unlink() and rmdir()Lennart Poettering2019-03-271-1/+1
| | | | | | Let's be helpful to static analyzers which care about whether we knowingly ignore return values. We do in these cases, since they are usually part of error paths.
* meson: generate version tag from gitZbigniew Jędrzejewski-Szmek2018-12-211-1/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | $ build/systemctl --version systemd 239-3555-g6178cbb5b5 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid $ git tag v240 -m 'v240' $ ninja -C build ninja: Entering directory `build' [76/76] Linking target fuzz-unit-file. $ build/systemctl --version systemd 240 +PAM +AUDIT +SELINUX +IMA -APPARMOR +SMACK +SYSVINIT +UTMP +LIBCRYPTSETUP +GCRYPT +GNUTLS +ACL +XZ +LZ4 +SECCOMP +BLKID +ELFUTILS +KMOD -IDN2 +IDN +PCRE2 default-hierarchy=hybrid This is very useful during development, because a precise version string is embedded in the build product and displayed during boot, so we don't have to guess answers for questions like "did I just boot the latest version or the one from before?". This change creates an overhead for "noop" builds. On my laptop, 'ninja -C build' that does nothing goes from 0.1 to 0.5 s. It would be nice to avoid this, but I think that <1 s is still acceptable. Fixes #7183. PACKAGE_VERSION is renamed to GIT_VERSION, to make it obvious that this is the more dynamically changing version string. Why save to a file? It would be easy to generate the version tag using run_command(), but we want to go through a file so that stuff gets rebuilt when this file changes. If we just defined an variable in meson, ninja wouldn't know it needs to rebuild things.