systemd-journal-remote use case update

This commit is contained in:
Kyrylo Gliebov 2018-11-16 19:55:12 +01:00 committed by Kirill Glebov
parent 2162092977
commit 91877b0570
3 changed files with 15 additions and 6 deletions

View file

@ -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)

View file

@ -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 */

View file

@ -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;