summaryrefslogtreecommitdiff
path: root/src/shared/logs-show.h
Commit message (Collapse)AuthorAgeFilesLines
* logs-show: rename "ts" paramater/variable to "display_ts"Lennart Poettering2023-02-071-1/+1
| | | | | | | | | | | | | | | | When displaying log data we deal with two kind of timestamps: the one we use for display (typically the source timestamp if available), and the one we use internally (typically the reception timestamp of journald). The user-facing output modes generally use the display timestamp, the ones intended for further processing (i.e. json + export outputs) do not, and directly query the timestamps of the entry, ignoring the source. This gets a bit confusing, since it's not always clear why we use which timestamp where. Let's address that by renaming the generic "ts" parameter/variable to "display_ts" to emphasize that the stored timestamp are "corrected" timestamps for display only. No real code change, just some renaming.
* journalctl: don't convert between strv/Set for each log lineLennart Poettering2023-01-201-1/+1
| | | | | | | | If output fields are specified, let's store this in a Set right-away, instead of converting between strv and Set again and again for each line. This is not only faster, but also simpler and shorter.
* basic: rename util.h to logarithm.hZbigniew Jędrzejewski-Szmek2022-11-081-1/+0
| | | | | util.h is now about logarithms only, so we can rename it. Many files included util.h for no apparent reason… Those includes are dropped.
* shared/logs-show: add new --output= format "short-delta"Daniel Braunwarth2022-09-231-1/+3
| | | | | | | This new output formatting option is similar to "short-monotonic" but also shows the time delta between two messages. This fixes #24641.
* license: LGPL-2.1+ -> LGPL-2.1-or-laterYu Watanabe2020-11-091-1/+1
|
* Revert "logs-show: declare [static 2] on all highlight parameters"Frantisek Sumsal2020-05-051-1/+1
| | | | | | This reverts commit 5444520628830aacab85be630a6cdeb179ff510b. See: https://github.com/systemd/systemd/pull/15706
* logs-show: declare [static 2] on all highlight parametersLennart Poettering2020-05-051-1/+1
|
* systemctl: show logs for correct namespace of serviceLennart Poettering2020-01-311-0/+1
|
* logs-show: make highlight parameter const (#10311)Lennart Poettering2018-10-091-1/+1
|
* tree-wide: remove Lennart's copyright linesLennart Poettering2018-06-141-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-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.
* shared/logs-show: export show_journal()Zbigniew Jędrzejewski-Szmek2018-05-311-0/+9
| | | | This is a nice function to output some journal entries without much ado.
* 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.
* 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.
* journalctl: add highlighting for matched substringZbigniew Jędrzejewski-Szmek2018-01-281-0/+1
| | | | | | | | | 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.
* 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.
* journalctl: add --output-fields= (#7181)Lars Karlitski2017-10-271-0/+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.
* shared: move output_mode_to_string() into output-mode.cLennart Poettering2016-04-221-3/+0
| | | | After all, the enum definition is in output-mode.h
* 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.
* shared: include what we useThomas Hindoe Paaboel Andersen2015-12-061-0/+4
| | | | | The next step of a general cleanup of our includes. This one mostly adds missing includes but there are a few removals as well.
* tree-wide: sort includes in *.hThomas Hindoe Paaboel Andersen2015-11-181-1/+1
| | | | | This is a continuation of the previous include sort patch, which only sorted for .c files.
* remove unused includesThomas Hindoe Paaboel Andersen2015-02-231-1/+0
| | | | | | This patch removes includes that are not used. The removals were found with include-what-you-use which checks if any of the symbols from a header is in use.
* loginctl: show the 10 most recent log user/session log lines in "loginctl ↵Lennart Poettering2015-01-081-2/+3
| | | | user-status" and "loginctl session-status"
* Always prefer our headers to system headersZbigniew Jędrzejewski-Szmek2014-07-311-1/+1
| | | | | | In practice this shouldn't make much difference, but sometimes our headers might be newer, and we want to test them.
* journal: add ability to browse journals of running OS containersLennart Poettering2013-12-111-1/+1
| | | | | | | This adds the new library call sd_journal_open_container() and a new "-M" switch to journalctl. Particular care is taken that journalctl's "-b" switch resolves to the current boot ID of the container, not the host.
* systemctl: show hint about --full when lines don't fitZbigniew Jędrzejewski-Szmek2013-08-111-2/+4
|
* systemctl: limit logs in status to current bootZbigniew Jędrzejewski-Szmek2013-06-041-0/+2
| | | | | | | Also reworded a few debug messages for brevity, and added a log statement which prints out the filter at debug level: Journal filter: (((UNIT=sys-module-configfs.device AND _PID=1) OR (COREDUMP_UNIT=sys-module-configfs.device AND MESSAGE_ID=fc2e22bc6ee647b6b90729ab34a250b1) OR _SYSTEMD_UNIT=sys-module-configfs.device) AND _BOOT_ID=4e3c518ab0474c12ac8de7896fe6b154)
* Add __attribute__((const, pure, format)) in various placesZbigniew Jędrzejewski-Szmek2013-05-021-2/+2
| | | | | | | | I'm assuming that it's fine if a _const_ or _pure_ function calls assert. It is assumed that the assert won't trigger, and even if it does, it can only trigger on the first call with a given set of parameters, and we don't care if the compiler moves the order of calls.
* logs-show: export logic to add matches for unitsZbigniew Jędrzejewski-Szmek2013-03-131-9/+10
| | | | | | After that functions which add matches, show_journal_by_unit and show_journal_by_user_unit, become nearly identical, so I merged them into one function.
* logs-show: add show_journal_by_user_unitMirco Tischler2013-01-181-0/+12
| | | | | Print the journal for a user session unit. For now this filters by _SYSTEMD_USER_UNIT and USER_UNIT and additionally _UID.
* systemctl,loginctl,cgls: do not ellipsize cgroup members when --full is ↵Lukas Nykryn2013-01-161-22/+1
| | | | | | | | | | | | | | | | | | | | specified New file output.h with output flags and modes. --full parameter also for cgls and loginctl. Include 'all' parameter in flags (show_cgroup_by_path, show_cgroup, show_cgroup_and_extra, show_cgroup_and_extra_by_spec). get_process_cmdline with max_length == 0 will not ellipsize output. Replace LINE_MAX with 0 in some calls of get_process_cmdline. [zj: Default to --full when under pager for clgs. Drop '-f' since it wasn't documented and didn't actually work. Reindent a bit. ]
* journal: implement message catalogLennart Poettering2012-11-151-1/+2
| | | | | | | | | | | | | | | | | The message catalog can be used to attach short help texts to log lines, keyed by their MESSAGE_ID= fields. This is useful to help the administrator understand the context and cause of a message, find possible solutions and find further related documentation. Since this is keyed off MESSAGE_ID= this will only work for native journal messages. The message catalog supports i18n, and is useful to augment english language system messages with explanations in the local language. This commit only includes short explanatory messages for a few example message IDs, we'll add more complete documentation for the relevant systemd messages later on.
* journal: add ability to list unique fields to gatewaydLennart Poettering2012-10-181-0/+6
|
* journal: support epxorting the journal in a format suitable for ↵Lennart Poettering2012-10-111-0/+1
| | | | text/event-stream
* logs-show: various cleanupsLennart Poettering2012-09-281-2/+7
| | | | | | Among other cleanups this introduces a threshold for the size of binary blobs we serialize as integer arrays in the JSON output. THis can be disabled via --all.
* journalctl: rework JSON output modeLennart Poettering2012-09-051-5/+5
| | | | | | | This splits the JSON output mode into different modes: json and json-pretty. The former printing one entry per line, the latter showing JSON objects nicely indented and in multiple lines to make it easier to read for humans.
* journalctl: hightlight log lines by priorityLennart Poettering2012-07-261-4/+5
| | | | | warn/notice = bright white < error = red
* use #pragma once instead of foo*foo #define guardsShawn Landden2012-07-191-4/+1
| | | | | | | | | | | | | | | | | #pragma once has been "un-deprecated" in gcc since 3.3, and is widely supported in other compilers. I've been using and maintaining (rebasing) this patch for a while now, as it annoyed me to see #ifndef fooblahfoo, etc all over the place, almost arrogant about the annoyance of having to define all these names to perform a commen but neccicary functionality, when a completely superior alternative exists. I havn't sent it till now, cause its kindof a style change, and it is bad voodoo to mess with style that has been established by more established editors. So feel free to lambast me as a crazy bafoon. v2 - preserve externally used headers
* journalctl: do not ellipsize when using pagerZbigniew Jędrzejewski-Szmek2012-07-171-0/+1
| | | | | | | If a pager is used, ellipsization is redundant — the pager does that better by hiding the part that cannot be shown. Pager's advantage is that the user can press → to view the hidden part of a message, and then ← to return.
* logs: Adapt interface in log-show.c (show_journal_by_unit)Zbigniew Jędrzejewski-Szmek2012-07-171-3/+3
| | | | Convert more flag arguments into one flag variable.
* logs: Adapt interface in log-show.c (output_journal)Zbigniew Jędrzejewski-Szmek2012-07-171-1/+7
| | | | | In preparation for adding more output switches, convert a series of flags arguments into one flag variable.
* journal: expose and make use of cutoff times of journalLennart Poettering2012-06-171-1/+2
| | | | | This helps explaining when the log output of "systemctl status" is incomplete because the logs got rotated since the service was started.
* move more common files to shared/ and add them to shared.laKay Sievers2012-04-121-0/+56