Commit Graph

468 Commits

Author SHA1 Message Date
Lennart Poettering 1dfa7e79a6 journald: only accept fds from certain directories 2012-10-03 11:55:38 -04:00
Lukas Nykryn fadd79d2d8 journald: assert target instead of page
page is a local, yet unitialized, variable.
2012-10-02 14:56:39 +02:00
Zbigniew Jędrzejewski-Szmek b2e6df73aa trivial: fix typo 2012-10-02 14:56:18 +02:00
Lennart Poettering 760c85c0bd journald: rework auto-rotation logic 2012-09-28 15:42:34 +02:00
Lennart Poettering 80d1c5988b journald: close sd_journal context after flushing to /var 2012-09-28 15:41:20 +02:00
Lennart Poettering bf5542f891 journal: add missing browse.html file 2012-09-28 00:59:10 +02:00
Lennart Poettering 7b17a7d72f journal: add minimal journal gateway daemon based on GNU libmicrohttpd
This minimal HTTP server can serve journal data via HTTP. Its primary
purpose is synchronization of journal data across the network. It serves
journal data in three formats:

       text/plain: the text format known from /var/log/messages
       application/json: the journal entries formatted as JSON
       application/vnd.fdo.journal: the binary export format of the journal

The HTTP server also serves a small HTML5 app that makes use of the JSON
serialization to present the journal data to the user.

Examples:

This downloads the journal in text format:

 # systemctl start systemd-journal-gatewayd.service
 # wget http://localhost:19531/entries

Same for JSON:

 # curl -H"Accept: application/json" http://localhost:19531/entries

Access via web browser:

 $ firefox http://localhost:19531/
2012-09-28 00:55:24 +02:00
Lennart Poettering be3ea5eaf2 sd-journal: properly parse cursor strings 2012-09-28 00:55:24 +02:00
Lennart Poettering 08ace05beb logs-show: various cleanups
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.
2012-09-28 00:55:24 +02:00
Lennart Poettering 8f14c8327b journalctl: add --cursor switch 2012-09-28 00:55:24 +02:00
Lennart Poettering 72f1d5a288 journal: also use new VA_FORMAT_ADVANCE() macro in sd_journal_send() 2012-09-24 23:42:03 +02:00
Lennart Poettering 2a7b539a82 journald: always pass first entry timestamp back from journal_file_verify() 2012-09-24 15:02:43 +02:00
Mirco Tischler 73726ac898 journalctl: print correct timespan in verify
The old code used a timestamp to print a timespan for unsealed journalfiles,
incorrectly showing things like 2230 days of unsealed entries. Print the timespan
between the first and last entry instead.
2012-09-24 14:56:52 +02:00
Mirco Tischler f1889c9119 journal: set seal even for readonly journalfiles
journalctl needs to know wether the file has been sealed to
be able to do verification.
2012-09-24 14:41:38 +02:00
Dave Reisner 585314e84c journalctl: reset cached column count on SIGWINCH
This requires a little bit of tip-toeing around to explicitly avoid
touching the environment from a sig handler. Instead, simply create a
function to reset the var to its "unset" state, allowing the next call
to columns() to recalculate and cache the new value.
2012-09-24 08:38:03 -04:00
Lennart Poettering 2a2507e60d journal: add missing test file 2012-09-24 10:18:10 +02:00
Lennart Poettering e2c8b07dcb journal: bring mmap cache prototype in sync 2012-09-22 00:16:13 +02:00
Lennart Poettering e18021f7da journal: always keep marked mmap windows around 2012-09-21 23:37:06 +02:00
Lennart Poettering c2893c4b34 journald: log how big the journal files may grow 2012-09-21 22:50:26 +02:00
Lennart Poettering 1705594f59 journalctl: make the argument to -n optional 2012-09-21 22:33:02 +02:00
Lennart Poettering f801968466 journal: completely rework the mmap cache as I too dumb to actually understand it
Instead of doing hand optimized fd bisect arrays just use plain old
hashmaps. Now I can understand my own code again. Yay!

As a side effect this should fix some bad memory accesses caused by
accesses after mmap(), introduced in 189.
2012-09-21 20:52:23 +02:00
Lennart Poettering 0559d3a58a journal: don't allow journal_file_open() to be called with ret being NULL 2012-09-21 16:16:39 +02:00
Lennart Poettering 505b6a61c2 journald: don't accept arbitrarily sized journal data fields
https://bugzilla.redhat.com/show_bug.cgi?id=858746
2012-09-19 22:51:28 +02:00
Lennart Poettering 7d5e9c0f60 util: define union dirent_storage and make use of it everywhere
Make sure to allocate enough space for readdir_r().

https://bugzilla.redhat.com/show_bug.cgi?id=858754
2012-09-19 22:21:09 +02:00
Lennart Poettering 468b21de7c journal: when comparing two entries from separate files make sure we reposition the mmap window
The mmap cache doesn't guarantee that we can look at two files at the
same time. Hence make sure to look at the entries to compare one
after the other, instead of at the same time when comparing them, and
reposition the window in between.
2012-09-19 09:58:34 +02:00
Lennart Poettering 178cc7700c journald: log when we fail to forward messages to syslog
https://bugzilla.redhat.com/show_bug.cgi?id=847207
2012-09-17 23:59:26 +02:00
Lennart Poettering b58b344afd journald: properly update perms on freshly rotate user journals 2012-09-17 15:53:42 +02:00
Thomas Hindoe Paaboel Andersen c53158818d man: fix a bunch of typos in docs
https://bugs.freedesktop.org/show_bug.cgi?id=54501
2012-09-13 19:34:24 +02:00
Lennart Poettering b588975fb0 journal: never assert directly on data read from the journal 2012-09-13 17:10:46 +02:00
Lennart Poettering 5996c7c295 journald: don't reposition window if we don't have to 2012-09-13 17:06:04 +02:00
Lennart Poettering cf5a343211 journalctl: print QR code only if we are running on an UTF-8 system 2012-09-12 09:23:38 +02:00
Lennart Poettering 49a32d43de journal: don't set seal flag if we don't have gcrypt built-in 2012-09-11 03:03:36 +02:00
Michael Olbrich 48b617399d journal: don't try to compress without XZ
otherwise the header contains the HEADER_INCOMPATIBLE_COMPRESSED
flag even though the data is not compressed and reading the journal
fails.
2012-09-11 03:01:14 +02:00
Lennart Poettering c17a8454f7 journald: don't do debug logging by default 2012-09-10 13:18:39 +02:00
Lennart Poettering 272410e179 journald: don't complain if fss key does not exist 2012-09-10 13:18:22 +02:00
Lennart Poettering 7762e02b17 journald: detect invalid header pointers correctly 2012-09-10 11:58:00 +02:00
Lennart Poettering 182b858fc2 journald: make splitting up of journal files per-user configurable 2012-09-07 23:40:00 +02:00
Lennart Poettering a1a03e3075 journal: add call to determine current journal file disk usage 2012-09-07 23:20:28 +02:00
Lennart Poettering 2b43f939a4 journald: avoid logging to kmsg in the normal paths 2012-09-06 00:32:51 -07:00
Lennart Poettering cd931c0a46 journalctl: show "Reboot" markers in output only when showing local-only entries 2012-09-05 16:52:46 -07:00
Lennart Poettering 9e8a535faa journalctl: replace --local by --merge, i.e. don't interleave remote journals by default 2012-09-05 16:49:00 -07:00
Lennart Poettering a6e87e90ed journalctl: rework JSON output mode
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.
2012-09-05 15:25:32 -07:00
Yin Kangkai 70f09301d5 journal: add HAVE_XZ check to avoid build failure
Without this, build fail with --disable-xz or xz not installed.
2012-08-25 02:01:12 +02:00
Allin Cottrell 4871690d9e journald: add missing includes 2012-08-24 01:46:38 +02:00
Lukas Nykryn f284860764 sd-journal: return null when mmap_cache_new fails 2012-08-23 13:53:30 +02:00
Lennart Poettering 99add6fd0b journalctl: complain if unprivileged users attempt to access the journal and persistant logging is off 2012-08-22 04:45:17 +02:00
Lennart Poettering d2bd7630d7 journal: the ratelimiter is part of journald 2012-08-22 03:43:45 +02:00
Lennart Poettering 0153028ae3 journald: split off native protocol support into its own .c file 2012-08-22 03:42:23 +02:00
Lennart Poettering 3b7124a8db journald: split console transport stuff into its own file 2012-08-22 03:36:29 +02:00
Lennart Poettering a45b9fca6b journald: move stream protocol into its own .c file 2012-08-22 03:32:41 +02:00
Lennart Poettering 5809560d85 journal: move syslog specific calls out of util.c 2012-08-22 03:24:46 +02:00
Lennart Poettering 35e2e347d3 journald: splitt of syslog protocol support into its own file 2012-08-22 03:21:03 +02:00
Lennart Poettering ef63833d53 journald: split /dev/kmsg related stuff into its own .c file 2012-08-22 03:09:44 +02:00
Lennart Poettering 671e021c92 journald: write tags also to user journal files 2012-08-22 02:53:51 +02:00
Lennart Poettering bdfb9e7f7c journald: augment journal entries from the kernel with data from udev 2012-08-22 02:49:17 +02:00
Lennart Poettering c0ca7aeec9 journalctl: be more friendly when informing about seal verification 2012-08-21 23:03:20 +02:00
Lennart Poettering cedb42bb69 journalctl: add a bit of color to the output 2012-08-21 15:53:48 +02:00
Lennart Poettering 24a598f889 journal: properly handle EPIPE from /dev/kmsg 2012-08-21 15:39:34 +02:00
Lennart Poettering fcde238921 journal: be more careful when keeping around mmaps we still need 2012-08-21 15:39:34 +02:00
Lennart Poettering 369f058921 verify: optimize entry search a bit by using bisection 2012-08-21 15:32:51 +02:00
Lennart Poettering 72fbdd3349 journal: initialize libgcrypt explicitly, before using HMAC 2012-08-21 01:44:38 +02:00
Lennart Poettering 89fef99014 journal: automatically evolve FSS key even when nothing is logged 2012-08-21 01:29:17 +02:00
Lennart Poettering c05276f23e journalctl: reword things a bit 2012-08-21 01:02:08 +02:00
Lennart Poettering adac1c93ab journal: rearrange QR code output a bit to fi to 80x25 terminals 2012-08-20 22:22:05 +02:00
Lennart Poettering eb53b74f7e journald: add new Seal= configuration option 2012-08-20 22:13:22 +02:00
Lennart Poettering 197c0da225 journalctl: explain QR code use 2012-08-20 22:11:55 +02:00
Lennart Poettering 92221ed7cb journal: include machine ID in QR code 2012-08-20 22:11:38 +02:00
Lennart Poettering f6a971bc0b journalctl: output FSS key as QR code on generating 2012-08-20 22:02:19 +02:00
Lennart Poettering 3e4b9b506d journal: add missing endianess conversion 2012-08-20 19:21:19 +02:00
Lennart Poettering feb12d3ed2 journal: make libgcrypt dependency optional 2012-08-20 16:51:46 +02:00
Lennart Poettering 8088cbd3cf journal: use a macro to check for file header flags 2012-08-20 16:11:42 +02:00
Lennart Poettering f7fab8a5ae journal: fix tag ordering check 2012-08-20 15:59:33 +02:00
Lennart Poettering a2e99cdf94 journal: fix bisection algorithm 2012-08-19 15:16:32 +02:00
Lennart Poettering fc89a13992 journal: validate timestamps as well 2012-08-19 15:16:11 +02:00
Lennart Poettering 84168d8068 mmap: resize arrays dynamically 2012-08-18 01:46:20 +02:00
Lennart Poettering fb9a24b6b1 journal: even more simple static object tests 2012-08-18 01:45:39 +02:00
Lennart Poettering 97147f8c1f journal: refuse verification of files with unknown flags 2012-08-18 00:41:06 +02:00
Lennart Poettering b72631e59c jounral: write bit fiddling test
This test goes through every single bit in a journal file, toggles it,
and checks if this change is detected by the verification.
2012-08-18 00:40:03 +02:00
Lennart Poettering c586dbf110 journal: fix verification without key 2012-08-18 00:38:57 +02:00
Lennart Poettering db11ac1ab5 journald: add additional simple static tests to verifier 2012-08-18 00:37:21 +02:00
Lennart Poettering a010801297 journal: be fine with opening rotated/corrupted journal files 2012-08-17 22:10:36 +02:00
Lennart Poettering f982e6f761 journal: set secure deletion flags for FSS file 2012-08-17 22:10:11 +02:00
Lennart Poettering 6c7be122ac journal: after verification output validated time range 2012-08-17 03:30:22 +02:00
Lennart Poettering 356fe3e6c6 journal: reword verification messages a bit 2012-08-17 03:01:07 +02:00
Lennart Poettering 7b5fd91c54 journal: ensure that entries and tags are properly ordered 2012-08-17 03:00:09 +02:00
Lennart Poettering 3223f44f23 journal: show new header fields in header dump 2012-08-17 02:29:20 +02:00
Lennart Poettering e627440b41 journal: don't write tag objects if nothing has been written since the last time 2012-08-17 01:19:32 +02:00
Lennart Poettering 31094aae09 man: add man pages for new FSS stuff 2012-08-17 01:09:43 +02:00
Lennart Poettering baed47c3c2 journal: rework terminology
Let's clean up our terminology a bit. New terminology:

FSS = Forward Secure Sealing
FSPRG = Forward Secure Pseudo-Random Generator

FSS is the combination of FSPRG and a HMAC.

Sealing = process of adding authentication tags to the journal.
Verification = process of checking authentication tags to the journal.

Sealing Key = The key used for adding authentication tags to the journal.
Verification Key = The key used for checking authentication tags of the journal.
Key pair = The pair of Sealing Key and Verification Key

Internally, the Sealing Key is the combination of the FSPRG State plus
change interval/start time.

Internally, the Verification Key is the combination of the FSPRG Seed
plus change interval/start time.
2012-08-17 00:45:18 +02:00
Lennart Poettering 14d10188de journal: add FSPRG journal authentication 2012-08-16 23:58:14 +02:00
Lennart Poettering a8e5f51484 journal: fix tag sequence number verification 2012-08-16 21:22:11 +02:00
Lennart Poettering 56e81f7ca8 journalctl: immeidately terminate on invalid seed 2012-08-16 21:00:47 +02:00
Lennart Poettering b7c9ae91d1 journal: parse fsprg seed 2012-08-16 21:00:47 +02:00
Lennart Poettering 2dee23ebe0 journal: count number of entry arrays in header 2012-08-16 21:00:47 +02:00
Zbigniew Jędrzejewski-Szmek 2737027897 journal: rename 'mmap' to 'mmap_cache' to appease gcc
warning: declaration of 'mmap' shadows a global declaration [-Wshadow]
2012-08-16 19:44:51 +02:00
Lennart Poettering 1137e6c73b journal: fix variable initialization 2012-08-16 17:39:00 +02:00
Lennart Poettering 2a7273ef92 journal: fix unitialized var 2012-08-16 17:22:58 +02:00
Lennart Poettering f5028bfaf0 journal: journal-send.h doesn't actually exist 2012-08-16 17:19:47 +02:00
Lennart Poettering 86adf873be journal: verify structural consistency 2012-08-16 17:10:58 +02:00
Lennart Poettering f9fffc31cd journal: add color to verification progress bar 2012-08-16 17:10:57 +02:00
Lennart Poettering fd5dc3204d journal: verify compressed objects 2012-08-16 17:10:57 +02:00
Lennart Poettering 4da416aa20 journalctl: add --verify-seed= switch to specify seed value 2012-08-16 17:10:57 +02:00
Lennart Poettering f59a5f6b87 journal: verify hashes only during actual verification, not all the time 2012-08-16 17:10:57 +02:00
Lennart Poettering 0284adc6a6 journal: split up journal-file.c 2012-08-16 17:10:57 +02:00
Lennart Poettering f65425cbc4 journal: add superficial structure verifier 2012-08-16 17:10:57 +02:00
Lennart Poettering beec008561 journal: implement basic journal file verification logic 2012-08-16 17:10:57 +02:00
Lennart Poettering 16e9f408fa journal: implement generic sharable mmap caching logic
instead of having one simple per-file cache implement an more
comprehensive one that works for multiple files and can actually
maintain multiple maps per file and per object type.
2012-08-16 17:10:56 +02:00
Lennart Poettering d98cc1f29f journal: include tag object header in hmac 2012-08-13 21:52:58 +02:00
Lennart Poettering b0af6f41ea journal: add all objects we add to HMAC 2012-08-13 20:57:38 +02:00
Lennart Poettering 7560fffcd2 journald: initial version of FSPRG hookup
This adds forward-secure authentication of journal files. This patch
includes key generation as well as tagging of journal files,
Verification of journal files will be added in a later patch.
2012-08-13 20:31:10 +02:00
Lennart Poettering cee5e9a7ca journald: never read the same kernel msg twice, and generate message when we lose one 2012-08-09 17:52:05 +02:00
Lennart Poettering b6a345143b journalctl: support device node matches as shortcut 2012-08-09 17:05:29 +02:00
Lennart Poettering 5b4c61cd0b journald: properly unescape messages from /dev/kmsg 2012-08-09 16:49:28 +02:00
Lennart Poettering e7573d7fa9 journald: also parse kernel key/value fields and store them prefixed with _KERNEL_ as journal fields 2012-08-09 16:29:16 +02:00
Lennart Poettering 51abe64c85 journald: basic support for /dev/kmsg parsing 2012-08-09 15:57:24 +02:00
Lennart Poettering 64825d3c58 fix a couple of issues found with llvm-analyze 2012-08-08 23:54:21 +02:00
Lennart Poettering c269cec334 build-sys: prepare release 188 2012-08-08 21:49:01 +02:00
Lennart Poettering de2c390731 journalctl: include corrupted files in output
If a journal file was rotated away because it was corrupted or dirty we
should still show its contents via "journalctl".
2012-08-07 00:51:17 +02:00
Zbigniew Jędrzejewski-Szmek ab060556a9 test: allow deletion of temporary files from normal fs
Not everybody has /tmp on tmpfs, and this was breaking 'make check'.
2012-08-03 18:11:55 +02:00
Lennart Poettering 18c7ed186b journal: add sd_journal_perror() to API 2012-08-01 19:53:23 +02:00
Artur Zaprzala 4cdc45994a journald: fixed memory leak 2012-07-31 14:15:34 +02:00
Lennart Poettering 941e990db1 journalctl: add --priority= switch for filtering by priority 2012-07-27 10:32:37 +02:00
Lennart Poettering c51742d029 journald: log driver messages at LOG_INFO 2012-07-26 16:56:22 +02:00
Lennart Poettering 498261871d journalctl: hightlight log lines by priority
warn/notice = bright white
< error = red
2012-07-26 16:56:21 +02:00
Shawn Landden 0d0f0c50d3 log.h: new log_oom() -> int -ENOMEM, use it
also a number of minor fixups and bug fixes: spelling, oom errors
that didn't print errors, not properly forwarding error codes,
few more consistency issues, et cetera
2012-07-26 11:48:26 +02:00
Shawn Landden 669241a076 use "Out of memory." consistantly (or with "\n")
glibc/glib both use "out of memory" consistantly so maybe we should
consider that instead of this.

Eliminates one string out of a number of binaries. Also fixes extra newline
in udev/scsi_id
2012-07-25 11:23:57 +02:00
Zbigniew Jedrzejewski-Szmek fafb6eccc2 journalctl: fix ellipsization with PAGER=cat
There are other reasons for not opening the pager then the --no-pager
or --follow options (described below). If the pager is not used,
messages must be ellipsized.

On Fri, Jul 20, 2012 at 05:42:44AM +0000, Shawn Landen wrote:
> "Pager to use when --no-pager is not given; overrides $PAGER.
> Setting this to an empty string or the value cat is equivalent to passing --no-pager."
2012-07-23 17:57:11 +02:00
Lennart Poettering 3146a302d1 journald: upgrade signal reception message to INFO 2012-07-19 12:44:58 +02:00
Shawn Landden c2f1db8f83 use #pragma once instead of foo*foo #define guards
#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
2012-07-19 12:30:59 +02:00
Lennart Poettering 4a842cadb8 journal: allow watching symlinked journal dirs 2012-07-19 03:22:07 +02:00
Lennart Poettering 7827b1a10f journal: when watching directories actually watch the directories asked for 2012-07-19 03:21:49 +02:00
Lennart Poettering a1a1898f71 journal: rotate busy files away when we try to write to them 2012-07-19 03:21:04 +02:00
Lennart Poettering 6f5878a286 journal: follow symlinks when enumerating journals 2012-07-19 02:35:17 +02:00
Lennart Poettering 9f8d29834b journald: don't choke on journal files with no cutoff date 2012-07-19 02:03:22 +02:00
Lennart Poettering 4a299a7ad5 journal: remove all of /run/log/journal when serializing, since the machine ID might deviate 2012-07-18 16:23:26 +02:00
Lennart Poettering 4ca86bbc25 journal: don't complain if the syslog forwarder socket doesn't exist 2012-07-18 16:23:06 +02:00
Lennart Poettering 361f9cbc7e journal: when we suggest a rotation, explain why 2012-07-18 16:22:40 +02:00
Lennart Poettering dfabe643f3 journal: estimate data hash table size a bit larger by default 2012-07-18 16:22:25 +02:00
Lennart Poettering c2a623d842 journald: fix another bad memory access
If we rotate due to header out of date we need the new journal file
object, too.
2012-07-18 13:28:39 +02:00
Lennart Poettering 32fca2d5b7 journald: fix bad memory access
After vacuuming we need to retrieve the journal file object again, since
it might have changed.
2012-07-18 13:13:15 +02:00
Zbigniew Jędrzejewski-Szmek 92a1fd9e95 journalctl: do not ellipsize when using pager
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.
2012-07-17 17:20:58 +02:00
Zbigniew Jędrzejewski-Szmek 25277cd7fb logs: Adapt interface in log-show.c (output_journal)
In preparation for adding more output switches, convert a series of
flags arguments into one flag variable.
2012-07-17 17:20:57 +02:00
Lennart Poettering cd96b3b86a journal: actually set archived files to archived state 2012-07-17 00:59:03 +02:00
Lennart Poettering dc36ac6733 journalctl: decode more header files in --header 2012-07-17 00:59:03 +02:00
Lennart Poettering 4a92baf3fa journal: size journal data hash table based on maximum file size metrics
The default of 2047 hash table entries turned out to result in way too
many collisions for bigger files, hence scale the hash table size by the
estimated maximum file size.
2012-07-17 00:59:03 +02:00
Lennart Poettering 71fa6f006f journal: immediately rotate when the journal was previously not closed properly 2012-07-17 00:59:03 +02:00
Lennart Poettering dca6219e04 journal: automatically rotate journal files if the data hash table is full > 75%
Previously, when the main data hash table grows too full the performance
simply started to decrease drastically. Instead, now simply rotate to a
new journal file as the hash table gets to full, so that we can start
with a new fresh empty hash table.
2012-07-17 00:59:03 +02:00
Lennart Poettering 162566a4a1 journal: use tail/head timestamps from header for cutoff logic
We have them, they are faster to use them, so use them...
2012-07-16 19:28:05 +02:00
Lennart Poettering 74d29da524 journald: don't enforce monotonicity of realtime clocks when copying entries
After all the point of the realtime clock (in contrast to the monotonic
clock) is that it does not have to be strictly monotonic, hence don't
enforce this when flushing the journal from /run to /var.
2012-07-16 19:26:54 +02:00
Ville Skyttä 49f43d5f91 Spelling fixes. 2012-07-16 12:16:29 +02:00