]> git.ipfire.org Git - thirdparty/systemd.git/commitdiff
journal-remote: make --url option support arbitrary url
authorYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 24 Jan 2016 06:45:47 +0000 (15:45 +0900)
committerYu Watanabe <watanabe.yu+github@gmail.com>
Sun, 24 Jan 2016 06:45:47 +0000 (15:45 +0900)
Currently, --url option supports the only form like http(s)://some.host:19531.
This commit adds support to call systemd-journal-remote as follwos:
systemd-journal-remote --url='http://some.host:19531'
systemd-journal-remote --url='http://some.host:19531/'
systemd-journal-remote --url='http://some.host:19531/entries'
systemd-journal-remote --url='http://some.host:19531/entries?boot&follow'
The first three example result the same and retrieve all entries.
The last example retrieves only current boot entries and wait new events.

src/journal-remote/journal-remote.c

index e7003da9c1a4415806cd7774a99f93105ccc2d53..fa0cc99b89e8eea74fe2193ea5ce1d9b07f0c745 100644 (file)
@@ -900,7 +900,14 @@ static int remoteserver_init(RemoteServer *s,
         if (arg_url) {
                 const char *url, *hostname;
 
-                url = strjoina(arg_url, "/entries");
+                if (!strstr(arg_url, "/entries")) {
+                        if (endswith(arg_url, "/"))
+                                url = strjoina(arg_url, "entries");
+                        else
+                                url = strjoina(arg_url, "/entries");
+                }
+                else
+                        url = strdupa(arg_url);
 
                 if (arg_getter) {
                         log_info("Spawning getter %s...", url);