From 91877b0570cb0840d79053bd6ee84c13f0e81f8e Mon Sep 17 00:00:00 2001 From: Kyrylo Gliebov Date: Fri, 16 Nov 2018 19:55:12 +0100 Subject: [PATCH] systemd-journal-remote use case update --- src/pkg/lib/journal.js | 2 ++ src/player.jsx | 4 ++-- src/recordings.jsx | 15 +++++++++++---- 3 files changed, 15 insertions(+), 6 deletions(-) diff --git a/src/pkg/lib/journal.js b/src/pkg/lib/journal.js index 2567a00..4fff73c 100644 --- a/src/pkg/lib/journal.js +++ b/src/pkg/lib/journal.js @@ -117,6 +117,8 @@ cmd.push("--cursor=" + options.cursor); if (options.after) cmd.push("--after=" + options.after); + if (options.merge) + cmd.push("-m"); /* journalctl doesn't allow reverse and follow together */ if (options.reverse) diff --git a/src/player.jsx b/src/player.jsx index 86d1ba7..b6d2e43 100644 --- a/src/player.jsx +++ b/src/player.jsx @@ -105,7 +105,7 @@ let PacketBuffer = class { /* The journalctl reading the recording */ this.journalctl = Journal.journalctl( this.matchList, - {count: "all", follow: false}); + {count: "all", follow: false, merge: true}); this.journalctl.fail(this.handleError); this.journalctl.stream(this.handleStream); this.journalctl.done(this.handleDone); @@ -454,7 +454,7 @@ let PacketBuffer = class { this.journalctl = Journal.journalctl( this.matchList, {cursor: this.cursor, - follow: true, count: "all"}); + follow: true, merge: true, count: "all"}); this.journalctl.fail(this.handleError); this.journalctl.stream(this.handleStream); /* NOTE: no "done" handler on purpose */ diff --git a/src/recordings.jsx b/src/recordings.jsx index af04b9d..f5abb08 100644 --- a/src/recordings.jsx +++ b/src/recordings.jsx @@ -238,6 +238,7 @@ class Logs extends React.Component { this.entries = []; this.start = null; this.end = null; + this.hostname = null; this.earlier_than = null; this.state = { cursor: null, @@ -282,12 +283,16 @@ class Logs extends React.Component { } let matches = []; + if (this.hostname) { + matches.push("_HOSTNAME=" + this.hostname); + } let options = { since: formatDateTime(this.start), until: formatDateTime(this.end), follow: false, count: "all", + merge: true, }; if (this.state.after != null) { @@ -322,6 +327,9 @@ class Logs extends React.Component { this.start = this.props.recording.start; this.earlier_than = this.props.recording.start; } + if (this.props.recording.hostname) { + this.hostname = this.props.recording.hostname; + } this.getLogs(); } } @@ -682,8 +690,7 @@ class View extends React.Component { } r = {id: id, - matchList: ["_UID=" + this.uid, - "TLOG_REC=" + id], + matchList: ["TLOG_REC=" + id], user: e["TLOG_USER"], boot_id: e["_BOOT_ID"], session_id: parseInt(e["TLOG_SESSION"], 10), @@ -735,7 +742,7 @@ class View extends React.Component { * Assumes journalctl is not running. */ journalctlStart() { - let matches = ["_UID=" + this.uid]; + let matches = ["_UID=" + this.uid, "+", "_EXE=/usr/bin/tlog-rec-session", "+", "_EXE=/usr/bin/tlog-rec", "+", "SYSLOG_IDENTIFIER=\"-tlog-rec-session\""]; if (this.state.username && this.state.username !== "") { matches.push("TLOG_USER=" + this.state.username); } @@ -743,7 +750,7 @@ class View extends React.Component { matches.push("_HOSTNAME=" + this.state.hostname); } - let options = {follow: true, count: "all"}; + let options = {follow: true, count: "all", merge: true}; if (this.state.date_since && this.state.date_since !== "") { options['since'] = this.state.date_since;