chiark / gitweb /
systemctl: shortcut log output for non-service, non-socket, non-mount, non-swap units
[elogind.git] / src / logs-show.c
index d178f95f94a6c34a70c7c3b47d9798abdb99c690..d44c50a291277ebe46874910fa27d3347494a6e0 100644 (file)
@@ -350,6 +350,12 @@ int show_journal_by_service(
 
         assert(service);
 
+        if (!endswith(service, ".service") &&
+            !endswith(service, ".socket") &&
+            !endswith(service, ".mount") &&
+            !endswith(service, ".swap"))
+                return 0;
+
         if (n_columns <= 0)
                 n_columns = columns();
 
@@ -359,7 +365,7 @@ int show_journal_by_service(
         if (!prefix)
                 prefix = "";
 
-        if (asprintf(&m, "_SYSTEMD_SERVICE=%s", service) < 0) {
+        if (asprintf(&m, "_SYSTEMD_UNIT=%s", service) < 0) {
                 r = -ENOMEM;
                 goto finish;
         }