{"id":20627155,"url":"https://github.com/bryopsida/node-journalctl","last_synced_at":"2026-01-22T05:06:08.096Z","repository":{"id":257803937,"uuid":"864347311","full_name":"bryopsida/node-journalctl","owner":"bryopsida","description":"Module for consuming the Systemd Journal","archived":false,"fork":false,"pushed_at":"2024-10-01T07:06:28.000Z","size":169,"stargazers_count":0,"open_issues_count":1,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2025-09-28T06:25:56.080Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":false,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":"jue89/node-journalctl","license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/bryopsida.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2024-09-28T01:56:54.000Z","updated_at":"2024-09-30T05:45:13.000Z","dependencies_parsed_at":"2024-11-06T09:01:17.150Z","dependency_job_id":null,"html_url":"https://github.com/bryopsida/node-journalctl","commit_stats":null,"previous_names":["bryopsida/node-journalctl"],"tags_count":4,"template":false,"template_full_name":null,"purl":"pkg:github/bryopsida/node-journalctl","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fnode-journalctl","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fnode-journalctl/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fnode-journalctl/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fnode-journalctl/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/bryopsida","download_url":"https://codeload.github.com/bryopsida/node-journalctl/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/bryopsida%2Fnode-journalctl/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28655139,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-22T01:17:37.254Z","status":"online","status_checked_at":"2026-01-22T02:00:07.137Z","response_time":144,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-11-16T13:15:58.504Z","updated_at":"2026-01-22T05:06:08.076Z","avatar_url":"https://github.com/bryopsida.png","language":"JavaScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# Journalctl\n\nThis is a module for accessing systemd journal.\n\n## API\n\nYou can find the documentation page [here](https://bryopsida.github.io/node-journalctl)\n\nRequire the module and create a new instance:\n\n```js\nconst Journalctl = require('@bryopsida/journalctl')\nconst journalctl = new Journalctl([opts])\n```\n\nThe optional object `opts` can have the following properties:\n\n- `identifier`: Just output logs of the given syslog identifier (cf. man journalctl, option '-t')\n- `unit`: Just output logs originated from the given unit file (cf. man journalctl, option '-u')\n- `filter`: An array of matches to filter by (cf. man journalctl, matches)\n- `all`: Show all fields in full, even if they include unprintable characters or are very long. (cf. man journalctl, option '-a')\n- `lines`: Show the most recent journal events and limit the number of events shown (cf. man journalctl, option '-n')\n- `since`: Start showing entries on or newer than the specified date (cf. man journalctl, option '-S')\n\n### Event: 'json-message'\n\n```js\njournalctl.on('json-message', event =\u003e {})\n```\n\nIs fired on every decoded json message.\n\n### Event: 'raw-message'\n\n```js\njournalctl.on('raw-message', buffer =\u003e {})\n```\n\nIs fired on every data event from the journalctl sub process.\n\n### Event: 'error'\n\n```js\njournalctl.on('error', err =\u003e {})\n```\n\nIs fired whenever the journalctl sub process emits an error or the class encounters an error condition.\n\n### Event: 'close'\n\n```js\njournalctl.on('close', () =\u003e {})\n```\n\nIs fired whenever the journalctl sub process exits with status code 0.\n\n### Method: stop\n\n```js\njournalctl.stop([callback])\n```\n\n### Method: getStdout\n\n```js\njournalctl.getStdout().pipe(process.stdout)\n```\n\nReturns the stdout stream from the journalctl sub process.\n\n### Method: getStderr\n\n```js\njournalctl.getStderr().pipe(process.stderr)\n```\n\nReturns the stderr stream from the journalctl sub process.\n\n## Examples\n\n### Decode and tail all logs\n\n```javascript\nconst Journalctl = require('@bryopsida/journalctl')\n\nconst logger = new Journalctl().on('json-message', e =\u003e {\n  console.log(e)\n})\n\nprocess.on('SIGINT', () =\u003e {\n  logger.stop(() =\u003e {\n    process.exit()\n  })\n})\n```\n\n### Pipe raw output\n\n```javascript\nconst Journalctl = require('@bryopsida/journalctl')\n\nconst j = new Journalctl({\n  disableJSONMessages: true,\n  emitRawMessages: false\n})\n\nj.getStdout().pipe(process.stdout)\nj.getStderr().pipe(process.stderr)\n\nprocess.on('SIGINT', () =\u003e {\n  j.stop(() =\u003e {\n    process.exit()\n  })\n})\n```\n\n### Process raw events\n\n```javascript\nconst Journalctl = require('@bryopsida/journalctl')\n\nconst j = new Journalctl({\n  disableJSONMessages: true,\n  emitRawMessages: true\n}).on('raw-message', buffer =\u003e {\n  process.stdout.write(buffer)\n})\n\nprocess.on('SIGINT', () =\u003e {\n  j.stop(() =\u003e {\n    process.exit()\n  })\n})\n```\n\n### Use command prefix\n\n```javascript\nconst Journalctl = require('@bryopsida/journalctl')\n\nconst j = new Journalctl({\n  commandPrefix: ['vagrant', 'ssh', '-c'],\n  quoteArgs: true,\n  spawnOptions: {\n    shell: true\n  }\n}).on('json-message', e =\u003e {\n  console.log(e)\n})\n\nprocess.on('SIGINT', () =\u003e {\n  j.stop(() =\u003e {\n    process.exit()\n  })\n})\n```\n\n## Test Environment\n\nIf you need a test environment with journald running, and you have [vagrant](https://www.vagrantup.com/) installed, you can spin one up with `vagrant up` and remove it with `vagrant destroy` once you are finished.\n\nYou can access the environment by using `vagrant ssh`. This project is available at `/vagrant` inside the vagrant box.\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryopsida%2Fnode-journalctl","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fbryopsida%2Fnode-journalctl","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fbryopsida%2Fnode-journalctl/lists"}