summaryrefslogtreecommitdiff
path: root/src/journal/journald-server.c
Commit message (Collapse)AuthorAge
* journald: fix space limits reportingZbigniew Jędrzejewski-Szmek2013-06-24
| | | | | | | | | Reporting of the free space was bogus, since the remaining space was compared with the maximum allowed, instead of the current use being compared with the maximum allowed. Simplify and fix by reporting limits directly at the point where they are calculated. Also, assign a UUID to the message.
* journald: bump the journal per-unit ratelimit defaultsLennart Poettering2013-06-21
| | | | | | Too many people kept hitting them, so let's increase the limits a bit. https://bugzilla.redhat.com/show_bug.cgi?id=965803
* journal: allow callers to specify OBJECT_PID=Zbigniew Jędrzejewski-Szmek2013-06-20
| | | | | | | | | | | | | | | | | | | | | | | When journald encounters a message with OBJECT_PID= set coming from a priviledged process (UID==0), additional fields will be added to the message: OBJECT_UID=, OBJECT_GID=, OBJECT_COMM=, OBJECT_EXE=, OBJECT_CMDLINE=, OBJECT_AUDIT_SESSION=, OBJECT_AUDIT_LOGINUID=, OBJECT_SYSTEMD_CGROUP=, OBJECT_SYSTEMD_SESSION=, OBJECT_SYSTEMD_OWNER_UID=, OBJECT_SYSTEMD_UNIT= or OBJECT_SYSTEMD_USER_UNIT=. This is for other logging daemons, like setroubleshoot, to be able to augment their logs with data about the process. https://bugzilla.redhat.com/show_bug.cgi?id=951627
* journald: do not calculate free space too earlyZbigniew Jędrzejewski-Szmek2013-06-13
| | | | | | | | | | | | | | | Since the system journal wasn't open yet, available_space() returned 0. Before: systemd-journal[22170]: Allowing system journal files to grow to 4.0G. systemd-journal[22170]: Journal size currently limited to 0B due to SystemKeepFree. After: systemd-journal[22178]: Allowing system journal files to grow to 4.0G. systemd-journal[22178]: Journal size currently limited to 3.0G due to SystemKeepFree. Also, when failing to write a message, show how much space was needed: "Failed to write entry (26 items, 260123456 bytes) despite vacuuming, ignoring: ...".
* journal: letting (interleaved) seqnums goZbigniew Jędrzejewski-Szmek2013-06-10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | In the following scenario: server creates system.journal server creates user-1000.journal both journals share the same seqnum_id. Then server writes to user-1000.journal first, and server writes to system.journal a bit later, and everything is fine. The server then terminates (crash, reboot, rsyslog testing, whatever), and user-1000.journal has entries which end with a lower seqnum than system.journal. Now server is restarted server opens user-1000.journal and writes entries to it... BAM! duplicate seqnums for the same seqnum_id. Now, we usually don't see that happen, because system.journal is closed last, and opened first. Since usually at least one message is written during boot and lands in the system.journal, the seqnum is initialized from it, and is set to a number higher than than anything found in user journals. Nevertheless, if system.journal is corrupted and is rotated, it can happen that an entry is written to the user journal with a seqnum that is a duplicate with an entry found in the corrupted system.journal~. When browsing the journal, journalctl can fall into a loop where it tries to follow the seqnums, and tries to go the next location by seqnum, and is transported back in time to to the older duplicate seqnum. There is not way to find out the maximum seqnum used in a multiple files, without actually looking at all of them. But we don't want to do that because it would be slow, and actually it isn't really possible, because a file might e.g. be temporarily unaccessible. Fix the problem by using different seqnum series for user journals. Using the same seqnum series for rotated journals is still fine, because we know that nothing will write to the rotated journal anymore. Likely related: https://bugs.freedesktop.org/show_bug.cgi?id=64566 https://bugs.freedesktop.org/show_bug.cgi?id=59856 https://bugs.freedesktop.org/show_bug.cgi?id=64296 https://bugs.archlinux.org/task/35581 https://bugzilla.novell.com/show_bug.cgi?id=817778 Possibly related: https://bugs.freedesktop.org/show_bug.cgi?id=64293
* journalctl: print monotonic timestamp in --headerZbigniew Jędrzejewski-Szmek2013-06-10
|
* journal: take KeepFree into account when reporting maximum sizeDaniel Albers2013-06-01
| | | | | When reporting the maximum journal size add a hint if it's limited by KeepFree.
* journald: DO recalculate the ACL mask, but only if it doesn't existJan Alexander Steffens (heftig)2013-05-30
| | | | | | | | Since 11ec7ce, journald isn't setting the ACLs properly anymore if the files had no ACLs to begin with: acl_set_fd fails with EINVAL. An ACL with ACL_USER or ACL_GROUP entries but no ACL_MASK entry is invalid, so make sure a mask exists before trying to set the ACL.
* journal: correctly convert usec_t to timespec.Michał Bartoszkiewicz2013-05-15
| | | | Use timespec_store instead of (incorrectly) doing it inline.
* journald: don't recalculate the ACL maskLennart Poettering2013-05-07
| | | | | Otherwise we might end up with executable files if some default ACL is set for the journal directory.
* journald: be more careful when we try to flush the runtime journal to disk ↵Lennart Poettering2013-05-07
| | | | | | | | and the disk is close to being full Bump the minimal size of the journal so that we can be sure creating the journal file will always succeed. Previously the minimum size was smaller than a empty jounral file...
* conf-parser: restrict .include usageLennart Poettering2013-04-25
| | | | | Disallow recursive .include, and make it unavailable in anything but unit files.
* journal: remove build warning when SELinux is disabledGreg Kroah-Hartman2013-04-25
| | | | A small patch to remove a build warnining when SELinux is disabled.
* cgroup: make sure all our cgroup objects have a suffix and are properly escapedLennart Poettering2013-04-22
| | | | | | | | | | | | | | Session objects will now get the .session suffix, user objects the .user suffix, nspawn containers the .nspawn suffix. This also changes the user cgroups to be named after the numeric UID rather than the username, since this allows us the parse these paths standalone without requiring access to the cgroup file system. This also changes the mapping of instanced units to cgroups. Instead of mapping foo@bar.service to the cgroup path /user/foo@.service/bar we will now map it to /user/foo@.service/foo@bar.service, in order to ensure that all our objects are properly suffixed in the tree.
* move _cleanup_ attribute in front of the typeHarald Hoyer2013-04-18
| | | | http://lists.freedesktop.org/archives/systemd-devel/2013-April/010510.html
* Report about syntax errors with metadataZbigniew Jędrzejewski-Szmek2013-04-17
| | | | | | | | | | | | | The information about the unit for which files are being parsed is passed all the way down. This way messages land in the journal with proper UNIT=... or USER_UNIT=... attribution. 'systemctl status' and 'journalctl -u' not displaying those messages has been a source of confusion for users, since the journal entry for a misspelt setting was often logged quite a bit earlier than the failure to start a unit. Based-on-a-patch-by: Oleksii Shevchuk <alxchk@gmail.com>
* nspawn: introduce the new /machine/ tree in the cgroup tree and move ↵Lennart Poettering2013-04-16
| | | | | | | | | | | | | | containers there Containers will now carry a label (normally derived from the root directory name, but configurable by the user), and the container's root cgroup is /machine/<label>. This label is called "machine name", and can cover both containers and VMs (as soon as libvirt also makes use of /machine/). libsystemd-login can be used to query the machine name from a process. This patch also includes numerous clean-ups for the cgroup code.
* journal: fix broken tags _SOURCE_REALTIME_TIMESTAMP and _MACHINE_IDMirco Tischler2013-04-12
|
* journald: no need to free audit varsLennart Poettering2013-04-08
|
* journald: drop two more memory allocationsLennart Poettering2013-04-08
|
* journald: get rid of one more memory allocationLennart Poettering2013-04-08
|
* journald: Do not dynamically allocate _UID/_GID/_PID stringsHolger Hans Peter Freyther2013-04-08
| | | | | | | Avoid the dynamic allocation for the _UID, _GID, and _PID strings. The maximum size of the string can be determined at compile time. The code has only been compile tested.
* journald: Do not always record _AUDIT_SESSION and _AUDIT_LOGINUIDHolger Hans Peter Freyther2013-04-08
| | | | | | When systemd was compiled without audit support, do not collect the audit session and loginuid in the journal. This is saving a couple of syscalls and memory allocations per log message.
* Use initalization instead of explicit zeroingZbigniew Jędrzejewski-Szmek2013-04-05
| | | | | | | | | | | | | | | | | | | | | | | Before, we would initialize many fields twice: first by filling the structure with zeros, and then a second time with the real values. We can let the compiler do the job for us, avoiding one copy. A downside of this patch is that text gets slightly bigger. This is because all zero() calls are effectively inlined: $ size build/.libs/systemd text data bss dec hex filename before 897737 107300 2560 1007597 f5fed build/.libs/systemd after 897873 107300 2560 1007733 f6075 build/.libs/systemd … actually less than 1‰. A few asserts that the parameter is not null had to be removed. I don't think this changes much, because first, it is quite unlikely for the assert to fail, and second, an immediate SEGV is almost as good as an assert.
* journal: Add sync timer to journal serverOleksii Shevchuk2013-03-25
| | | | | | | | Add option to force journal sync with fsync. Default timeout is 5min. Interval configured via SyncIntervalSec option at journal.conf. Synced journal files will be marked as OFFLINE. Manual sync can be performed via sending SIGUSR1.
* journal,shared: add _cleanup_journal_close_Zbigniew Jędrzejewski-Szmek2013-03-18
|
* journal: pass the *pid* to sd_pid_get_owner_uid()Kay Sievers2013-03-16
|
* journald: introduce new "systemd-journal" group and make it own the journal ↵Lennart Poettering2013-03-05
| | | | | | | | | | | | | | | | | | | | | files Previously all journal files were owned by "adm". In order to allow specific users to read the journal files without granting it access to the full "adm" powers, introduce a new specific group for this. "systemd-journal" has to be created by the packaging scripts manually at installation time. It's a good idea to assign a static UID/GID to this group, since /var/log/journal might be shared across machines via NFS. This commit also grants read access to the journal files by default to members of the "wheel" and "adm" groups via file system ACLs, since these "almost-root" groups should be able to see what's going on on the system. These ACLs are created by "make install". Packagers probably need to duplicate this logic in their postinst scripts. This also adds documentation how to grant access to the journal to additional users or groups via fs ACLs.
* journald: stpcpy() + mempcpy() are awesomeLennart Poettering2013-03-05
|
* journald: drop splitting-by-audit entirelyLennart Poettering2013-03-05
| | | | | Thinking about it we should probably not hide bugs by falling back to audit when we have our own session information anyway.
* journald: be a bit more careful when spitting up journals by user idLennart Poettering2013-03-05
|
* journald: check session owner UID rather then audit ID when splitting up ↵Lennart Poettering2013-03-05
| | | | | | | journal files We should always go by our own cgroup hierarchy before using foreign schemes such as audit, so let's do that for the split out logic too.
* journal: split journal uid only when audit uid data is validKay Sievers2013-03-04
|
* journald: do not barf when setting RateLimitInterval=0Zbigniew Jędrzejewski-Szmek2013-03-03
| | | | Assertion 'interval > 0 || burst == 0' failed at src/journal/journald-rate-limit.c:78, function journal_rate_limit_new(). Aborting.
* honor SELinux labels, when creating and writing config filesHarald Hoyer2013-02-14
| | | | | | | Also split out some fileio functions to fileio.c and provide a SELinux aware pendant in fileio-label.c see https://bugzilla.redhat.com/show_bug.cgi?id=881577
* journal: Don't use loginuid if it's not validColin Walters2013-02-13
| | | | | | | | | | | Code above this attempted to load loginuid, if this failed for whatever reason, we'd still end up using that value (0) in place of realuid. Fix this by setting a bool when we know the loginuid is valid. This fixes journal messages showing up in per-user journals in gnome-ostree (not configured with loginuid, but I'll shortly fix that).
* journal: log _SYSTEMD_USER_UNIT for user session unitsMirco Tischler2013-01-18
|
* systemctl,loginctl,cgls: do not ellipsize cgroup members when --full is ↵Lukas Nykryn2013-01-16
| | | | | | | | | | | | | | | | | | | | 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. ]
* journald: use automatic cleanupZbigniew Jędrzejewski-Szmek2013-01-10
|
* journal: by default do not decompress dat objects larger than 64KLennart Poettering2012-11-21
| | | | | | | | | | 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.
* journald: fix bad memory accessLennart Poettering2012-11-20
| | | | https://bugzilla.redhat.com/show_bug.cgi?id=875653
* build-sys: store journald code in a noinst libraryZbigniew Jędrzejewski-Szmek2012-11-14
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.