diff options
author | Yu Watanabe <watanabe.yu+github@gmail.com> | 2016-01-24 15:45:47 +0900 |
---|---|---|
committer | Yu Watanabe <watanabe.yu+github@gmail.com> | 2016-01-24 15:45:47 +0900 |
commit | b68f6b0a794f9e6cb6457a0ac55041c4e7b1a5cb (patch) | |
tree | 5850c54ef1f07c80b32435646470b4b6947abf89 | |
parent | 9d5a981398accce14ce0e824122c6748728b4631 (diff) |
journal-remote: make --url option support arbitrary url
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.
-rw-r--r-- | src/journal-remote/journal-remote.c | 9 |
1 files changed, 8 insertions, 1 deletions
diff --git a/src/journal-remote/journal-remote.c b/src/journal-remote/journal-remote.c index e7003da9c1..fa0cc99b89 100644 --- a/src/journal-remote/journal-remote.c +++ b/src/journal-remote/journal-remote.c @@ -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); |