TypeScript library of the journalctl tool included in Linux distributions.
npm install @mahsumurebe/journalctltypescript
import Journalctl from '@mahsumurebe/journalctl';
`$3
`typescript
const Journalctl = require('@mahsumurebe/journalctl');
`$3
`typescript
const journalctl = new Journalctl([opts])
`The optional object
object can be have the following properties.-
identifier: Show entries with the specified syslog identifier
- units: Show logs from the specified unit(s)
- userUnits: Show logs from the specified user unit(s)
- all: Show all fields, including long and unprintable
- lines: Show entries with the specified syslog identifier
- since: Show entries not older than the specified date
- utc: Express time in Coordinated Universal Time (UTC)$3
It is triggered at each log event and returns the object event that describes the event.
`typescript
journalctl.on('event', (event: IJournalEvent) => {
console.log(event);
})
`
$3
Stops journalctl stream.
`typescript
journalctl.stop();
``