Commit Graph

468 Commits

Author SHA1 Message Date
Zbigniew Jędrzejewski-Szmek 80701564cd journal: move _packed_ attribute to the end
GCC manual states that "For an enum, struct or union type, you may
specify attributes either between the enum, struct or union tag and
the name of the type, or just past the closing curly brace of the
definition. The former syntax is preferred." This means that the
attribute should not be located before 'struct'. Putting it between
'struct' and the name seems cluttered. Putting it at the end seems
most readable.

This avoids clang warnings.
2012-12-17 11:41:31 +01:00
Zbigniew Jędrzejewski-Szmek 29abad107f journal: fix warning about pointer arithmetic
../src/journal/journal-send.c: In function 'sd_journal_sendv':
../src/journal/journal-send.c:250:73: warning: pointer of type 'void *' used in arithmetic [-Wpointer-arith]
2012-11-25 21:43:44 +01:00
Zbigniew Jędrzejewski-Szmek 4a1909bb66 journal-gatewayd: minor cleanup 2012-11-25 18:04:03 +01:00
Lennart Poettering be2155ce70 journal: fix SO_PASSSEC invocation
Spotted by Lukas Nykryn
2012-11-23 18:35:27 +01:00
Lennart Poettering 93b73b064c journal: by default do not decompress dat objects larger than 64K
This introduces a new data threshold setting for sd_journal objects
which controls the maximum size of objects to decompress. This is
relieves the library from having to decompress full data objects even
if a client program is only interested in the initial part of them.

This speeds up "systemd-coredumpctl" drastically when invoked without
parameters.
2012-11-21 00:28:00 +01:00
Lennart Poettering 8f1e860f8a journal: add sd_journal_get_catalog_for_message_id() as API to get catalog entry for any message ID without requiring an open journal file 2012-11-20 21:39:16 +01:00
Lennart Poettering ee55db4144 journal-send: always send SYSLOG_IDENTIFIER, if we have it
https://bugzilla.redhat.com/show_bug.cgi?id=872193
2012-11-20 21:39:16 +01:00
Lennart Poettering 3ed08c446c journal-send: unify a bit of code 2012-11-20 21:39:16 +01:00
Lennart Poettering 7d73c1343b journald: fix bad memory access
https://bugzilla.redhat.com/show_bug.cgi?id=875653
2012-11-20 00:21:44 +01:00
Zbigniew Jędrzejewski-Szmek e3657ecd7f journalctl: add option to forgo ellipsization
Sometimes it is better to see messages in full, and the existing
set of options didn't allow this easily. E.g. now

  journalctl -f --full

will behave like

  tail -f /var/log/messages

of yore.

Long option only for now, since small letters are becoming
scarce, and this doesn't feel like a capital-letter-option.
'-u' would be nice, and the above command would be spelled

  journalctl -fu
2012-11-17 15:32:04 +01:00
Zbigniew Jędrzejewski-Szmek 4ec24515da journal: use $(localstatedir)/lib/systemd/catalog for the catalog
The path doesn't change in the standard configuration.

Also, give full path to the journalctl binary in the hook,
since it might be installed outside of $PATH.

Also, add uninstall hook to remove the binary catalog.
2012-11-16 23:29:18 +01:00
Zbigniew Jędrzejewski-Szmek 943aad8ca5 journal, shared: fix warnings during compilation on 32 bits
Some filesystem magics are too big to fit in 31 bits,
and are wrapped to negative. f_type is an int on 32 bits, so
it is signed, and we get a warning on comparison.
2012-11-16 23:26:44 +01:00
Kay Sievers 7c670f5b44 journal: catalog - silent output, it's usually only called by package management 2012-11-16 19:34:53 +01:00
Zbigniew Jędrzejewski-Szmek 80343dc19a journalctl: better error messages for --update-catalog
Also add informational message about catalog size.
2012-11-16 10:46:50 +01:00
Lennart Poettering 83f6936a01 journal: extend catalog header to 64bit for all fields, just to be safe and follow the rest of the file formats 2012-11-16 01:35:11 +01:00
Lennart Poettering d4205751d4 journal: implement message catalog
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.
2012-11-15 23:09:07 +01:00
Lekensteyn 71c0159692 journalctl: require argument for --priority
This fixes a segfault due to a missing value for --priority. -p is
unaffected because it is specified in the getopt_long parameter list.
2012-11-15 16:09:02 +01:00
Zbigniew Jędrzejewski-Szmek d025f1e4dc build-sys: store journald code in a noinst library
The point is to allow the use of journald functions by other binaries.
Before, journald code was split into multiple files (journald-*.[ch]),
but all those files all required functions from journald.c. And
journald.c has its own main(). Now, it is possible to link against
those functions, e.g. from test binaries.

This constitutes a fix for https://bugzilla.redhat.com/show_bug.cgi?id=872638.

The patch does the following:
1. rename journald.h to journald-server.h and move corresponding code
   to journald-server.c.
2. add journald-server.c and other journald-*.c parts to
   libsystemd-journal-internal.
3. remove journald-syslog.c from test_journal_syslog_SOURCES, since
   it is now contained in libsystemd-journal-internal.
There are no code changes, apart from the removal of a few static's,
to allow function calls between files.
2012-11-14 23:39:53 +01:00
Thomas Hindoe Paaboel Andersen 33b4055123 remove duplicate semicolons 2012-11-12 22:38:44 +01:00
Dave Reisner a9cdc94f7f enable localization for common *ctl commands 2012-11-12 14:16:07 -05:00
Dave Reisner ef216ca3d7 coredumpctl: add missing -F, --field option to help 2012-11-09 14:14:53 -05:00
Dave Reisner 584f587295 systemd-coredumpctl: add 'gdb' to usage output 2012-11-09 10:04:08 -05:00
Michal Schmidt 0901758558 util: add is_locale_utf8()
journalctl and vconsole-setup both implement utf8 locale detection.
Let's have a common function for it.
The next patch will add another use.
2012-11-02 17:27:15 +01:00
Zbigniew Jędrzejewski-Szmek 4f76ae1b4b coredumpctl: add --field/-F option
Useful for completion generation.
2012-10-30 11:26:49 +01:00
Zbigniew Jędrzejewski-Szmek 9a34088094 coredumpctl: add --no-legend option
Useful for completion generation.
2012-10-30 11:26:49 +01:00
Zbigniew Jędrzejewski-Szmek 2fb7a5ce67 coredumpctl: fix program return code 2012-10-30 11:24:00 +01:00
Zbigniew Jędrzejewski-Szmek 57ce4bd4ea coredumpctl: add guard to options table
It is not nice to segfault on unknown options :(
2012-10-30 11:23:59 +01:00
Michal Sekletar 4a207bb2a5 journal: fix memleak, call set_free before return 2012-10-28 02:14:40 +02:00
Lennart Poettering ada45c785f coredumpctl: add 'gdb' verb to start gdb right-away on a collected coredump 2012-10-27 01:19:47 +02:00
Lennart Poettering 684341b073 coredumpctl: show timestamps in list 2012-10-26 20:34:39 +02:00
Lennart Poettering 34741aa3e2 journal: special case the trivial cache chain cache entry 2012-10-26 20:25:36 +02:00
Lennart Poettering 8bc8ab83c8 coredumpctl: optimize journal entry parsing a bit by enumerating only once 2012-10-26 20:25:10 +02:00
Lennart Poettering ccc403587c coredumpctl: initialize global vars 2012-10-26 20:23:28 +02:00
Lennart Poettering 85210bffd8 journal: provide an API that allows client to figure out whether they need to recheck the journal manually for changes in regular intervals
Network file systems generally do not offer inotify() that would work
across the network. We hence cannot rely on inotify() exclusiely in
those case. Provide an API to determine these cases, and suggest doing
manual regular rechecks.

Note that this is not complete yet, as we need to rescan journal dirs on
network file systems explicitly to find new/removed files
2012-10-26 20:07:33 +02:00
Lennart Poettering e9f600f2fb journal: fix parsing of monotonic kernel timestamps 2012-10-26 14:56:41 +02:00
Lennart Poettering a4bcff5ba3 journal: introduce entry array chain cache
When traversing entry array chains for a bisection or for retrieving an
item by index we previously always started at the beginning of the
chain. Since we tend to look at the same chains repeatedly, let's cache
where we have been the last time, and maybe we can skip ahead with this
the next time.

This turns most bisections and index lookups from O(log(n)*log(n)) into
O(log(n)). More importantly however, we seek around on disk much less,
which is good to reduce buffer cache and seek times on rotational disks.
2012-10-26 03:24:03 +02:00
Lennart Poettering 7fb4d896e1 test: extend test-send to send some weirder data 2012-10-26 01:18:41 +02:00
Lennart Poettering 0f91dd8749 journal: properly determine cutoff max date 2012-10-26 01:18:41 +02:00
Lennart Poettering d99ae53a73 journal: properly serialize fields with multiple values into JSON
This now matches the JSON serialization spec from:

http://www.freedesktop.org/wiki/Software/systemd/json
2012-10-25 01:24:44 +02:00
Lennart Poettering db87a36e74 journalctl: remove left-over log message 2012-10-24 01:06:31 +02:00
Kay Sievers 3c62146280 shared: move sparse-endian.h from journal 2012-10-22 18:08:48 +02:00
Lennart Poettering e8c61d7b74 journal: use le64_t instead of uint64_t where this is appropriate 2012-10-21 03:35:54 +02:00
Lennart Poettering 0962e09ec3 journal: link up documentation with the file structure header 2012-10-20 17:01:19 +02:00
Zbigniew Jędrzejewski-Szmek 5de0409e54 journal: add tool to extract coredumps
'systemd-coredumpctl' will list available coredumps:
   PID   UID   GID sig exe
 32452  500  500  11 /home/zbyszek/systemd/build/journalctl
 32666  500  500  11 /usr/lib64/valgrind/memcheck-amd64-linux
...

'systemd-coredumpctl dump PID' will write the coredump
to specified file or stdout.
2012-10-19 15:15:38 +00:00
Lennart Poettering 6d9082172c journald.conf: remove MinSize= settings
There's no point in making this configurable, so let's drop it in order
to simplify configuration a bit.
2012-10-19 00:56:42 +02:00
Lennart Poettering ed757c0cb0 util: unify line caching and column caching 2012-10-19 00:07:55 +02:00
Lennart Poettering 8481248b9f util: unify usage of on_tty() in util.c 2012-10-19 00:07:55 +02:00
Lennart Poettering f89a3b6f5b journalctl: unify ellipsation handling between journalctl and systemctl 2012-10-18 23:35:44 +02:00
Lennart Poettering cd4b13e0bf journalctl: don't ellipsize unless on a tty 2012-10-18 23:35:44 +02:00
Lennart Poettering fd6e887537 journalctl: honour -n if -F is used 2012-10-18 23:35:44 +02:00