mirror of
https://github.com/balena-os/balena-supervisor.git
synced 2025-06-23 09:35:22 +00:00
Add journald format flag
Change-type: minor Signed-off-by: Cameron Diver <cameron@balena.io>
This commit is contained in:
@ -539,8 +539,9 @@ export function createV2Api(router: Router, applications: ApplicationManager) {
|
||||
const follow = checkTruthy(req.body.follow) || false;
|
||||
const count = checkInt(req.body.count, { positive: true }) || undefined;
|
||||
const unit = req.body.unit;
|
||||
const format = req.body.format || 'short';
|
||||
|
||||
const journald = spawnJournalctl({ all, follow, count, unit });
|
||||
const journald = spawnJournalctl({ all, follow, count, unit, format });
|
||||
res.status(200);
|
||||
journald.stdout.pipe(res);
|
||||
res.on('close', () => {
|
||||
|
@ -8,13 +8,12 @@ export function spawnJournalctl(opts: {
|
||||
follow: boolean;
|
||||
count?: number;
|
||||
unit?: string;
|
||||
format: string;
|
||||
}): ChildProcess {
|
||||
const args = [
|
||||
// The directory we want to run the chroot from
|
||||
constants.rootMountPoint,
|
||||
'journalctl',
|
||||
'-o',
|
||||
'export',
|
||||
];
|
||||
if (opts.all) {
|
||||
args.push('-a');
|
||||
@ -30,6 +29,8 @@ export function spawnJournalctl(opts: {
|
||||
args.push('-n');
|
||||
args.push(opts.count.toString());
|
||||
}
|
||||
args.push('-o');
|
||||
args.push(opts.format);
|
||||
|
||||
log.debug('Spawning journald with: chroot ', args.join(' '));
|
||||
|
||||
|
Reference in New Issue
Block a user