|
|
771b4bc |
From 7597d725aedc4bce6dc5ad20350d4f8e17b756d9 Mon Sep 17 00:00:00 2001
|
|
|
771b4bc |
From: Lennart Poettering <lennart@poettering.net>
|
|
|
771b4bc |
Date: Tue, 27 Mar 2012 00:14:29 +0200
|
|
|
771b4bc |
Subject: [PATCH] journalctl: add --local switch (cherry picked from commit
|
|
|
771b4bc |
2bd3c38a44c5c3acbf5afdb9c0bcbaf4a72dac3f)
|
|
|
771b4bc |
|
|
|
771b4bc |
---
|
|
|
771b4bc |
TODO | 2 ++
|
|
|
771b4bc |
man/journalctl.xml | 8 ++++++++
|
|
|
771b4bc |
src/journal/journalctl.c | 13 ++++++++++---
|
|
|
771b4bc |
3 files changed, 20 insertions(+), 3 deletions(-)
|
|
|
771b4bc |
|
|
|
771b4bc |
diff --git a/TODO b/TODO
|
|
|
771b4bc |
index 7f19c3a..2fe676a 100644
|
|
|
771b4bc |
--- a/TODO
|
|
|
771b4bc |
+++ b/TODO
|
|
|
771b4bc |
@@ -18,6 +18,8 @@ Bugfixes:
|
|
|
771b4bc |
|
|
|
771b4bc |
Features:
|
|
|
771b4bc |
|
|
|
771b4bc |
+* Make -f in systemctl enable both --follow and --force
|
|
|
771b4bc |
+
|
|
|
771b4bc |
* ensure that logind sets the syslog facility to AUTH when logging
|
|
|
771b4bc |
|
|
|
771b4bc |
* when a service has the same env var set twice we actually store it twice and return that in systemctl show -p... We should only show the last setting
|
|
|
771b4bc |
diff --git a/man/journalctl.xml b/man/journalctl.xml
|
|
|
771b4bc |
index c4d2a7e..efceefa 100644
|
|
|
771b4bc |
--- a/man/journalctl.xml
|
|
|
771b4bc |
+++ b/man/journalctl.xml
|
|
|
771b4bc |
@@ -200,6 +200,14 @@
|
|
|
771b4bc |
</varlistentry>
|
|
|
771b4bc |
|
|
|
771b4bc |
<varlistentry>
|
|
|
771b4bc |
+ <term><option>--local</option></term>
|
|
|
771b4bc |
+ <term><option>-l</option></term>
|
|
|
771b4bc |
+
|
|
|
771b4bc |
+ <listitem><para>Show only locally
|
|
|
771b4bc |
+ generated messages.</para></listitem>
|
|
|
771b4bc |
+ </varlistentry>
|
|
|
771b4bc |
+
|
|
|
771b4bc |
+ <varlistentry>
|
|
|
771b4bc |
<term><option>--new-id128</option></term>
|
|
|
771b4bc |
|
|
|
771b4bc |
<listitem><para>Instead of showing
|
|
|
771b4bc |
diff --git a/src/journal/journalctl.c b/src/journal/journalctl.c
|
|
|
771b4bc |
index f90b2dd..01dceca 100644
|
|
|
771b4bc |
--- a/src/journal/journalctl.c
|
|
|
771b4bc |
+++ b/src/journal/journalctl.c
|
|
|
771b4bc |
@@ -46,6 +46,7 @@ static int arg_lines = -1;
|
|
|
771b4bc |
static bool arg_no_tail = false;
|
|
|
771b4bc |
static bool arg_new_id128 = false;
|
|
|
771b4bc |
static bool arg_quiet = false;
|
|
|
771b4bc |
+static bool arg_local = false;
|
|
|
771b4bc |
|
|
|
771b4bc |
static int help(void) {
|
|
|
771b4bc |
|
|
|
771b4bc |
@@ -61,7 +62,8 @@ static int help(void) {
|
|
|
771b4bc |
" -o --output=STRING Change journal output mode (short, short-monotonic,\n"
|
|
|
771b4bc |
" verbose, export, json, cat)\n"
|
|
|
771b4bc |
" -q --quiet Don't show privilege warning\n"
|
|
|
771b4bc |
- " --new-id128 Generate a new 128 Bit id\n",
|
|
|
771b4bc |
+ " --new-id128 Generate a new 128 Bit id\n"
|
|
|
771b4bc |
+ " -l --local Only local entries\n",
|
|
|
771b4bc |
program_invocation_short_name);
|
|
|
771b4bc |
|
|
|
771b4bc |
return 0;
|
|
|
771b4bc |
@@ -87,6 +89,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|
|
771b4bc |
{ "no-tail", no_argument, NULL, ARG_NO_TAIL },
|
|
|
771b4bc |
{ "new-id128", no_argument, NULL, ARG_NEW_ID128 },
|
|
|
771b4bc |
{ "quiet", no_argument, NULL, 'q' },
|
|
|
771b4bc |
+ { "local", no_argument, NULL, 'l' },
|
|
|
771b4bc |
{ NULL, 0, NULL, 0 }
|
|
|
771b4bc |
};
|
|
|
771b4bc |
|
|
|
771b4bc |
@@ -95,7 +98,7 @@ static int parse_argv(int argc, char *argv[]) {
|
|
|
771b4bc |
assert(argc >= 0);
|
|
|
771b4bc |
assert(argv);
|
|
|
771b4bc |
|
|
|
771b4bc |
- while ((c = getopt_long(argc, argv, "hfo:an:q", options, NULL)) >= 0) {
|
|
|
771b4bc |
+ while ((c = getopt_long(argc, argv, "hfo:an:ql", options, NULL)) >= 0) {
|
|
|
771b4bc |
|
|
|
771b4bc |
switch (c) {
|
|
|
771b4bc |
|
|
|
771b4bc |
@@ -150,6 +153,10 @@ static int parse_argv(int argc, char *argv[]) {
|
|
|
771b4bc |
arg_quiet = true;
|
|
|
771b4bc |
break;
|
|
|
771b4bc |
|
|
|
771b4bc |
+ case 'l':
|
|
|
771b4bc |
+ arg_local = true;
|
|
|
771b4bc |
+ break;
|
|
|
771b4bc |
+
|
|
|
771b4bc |
case '?':
|
|
|
771b4bc |
return -EINVAL;
|
|
|
771b4bc |
|
|
|
771b4bc |
@@ -216,7 +223,7 @@ int main(int argc, char *argv[]) {
|
|
|
771b4bc |
log_warning("Showing user generated messages only. Users in the group 'adm' can see all messages. Pass -q to turn this message off.");
|
|
|
771b4bc |
#endif
|
|
|
771b4bc |
|
|
|
771b4bc |
- r = sd_journal_open(&j, 0);
|
|
|
771b4bc |
+ r = sd_journal_open(&j, arg_local ? SD_JOURNAL_LOCAL_ONLY : 0);
|
|
|
771b4bc |
if (r < 0) {
|
|
|
771b4bc |
log_error("Failed to open journal: %s", strerror(-r));
|
|
|
771b4bc |
goto finish;
|