npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

@into-cps-association/logger-ms

v0.1.2

Published

DTaaS logger microservice

Readme

:notebook: Logger microservice

The logger microservice ingests workflow log events produced by the DTaaS client and stores them as JSON Lines (.jsonl), which is easy to process with jq.

:arrow_down: Install

Default NPM Registry

The default registry for npm packages is npmjs. Install the package with the following command

npm install -g @into-cps-association/logger-ms

Github NPM Registry

The package is also available in Github packages registry.

Set the registry and install the package with the following commands

npm config set @into-cps-association:registry https://npm.pkg.github.com
npm install -g @into-cps-association/logger-ms

The npm install command asks for username and password. The username is your Github username and the password is your Github personal access token. In order for the npm to download the package, your personal access token needs to have read:packages scope.

API

  • GET /logger/health returns service status.
  • POST /logger ingests one event and appends it to a JSONL file.

Configuration

The service loads configuration in this order:

  1. CLI --config <file> or -c <file>
  2. LOGGER_CONFIG_PATH environment variable
  3. logger.yaml in the current working directory (if present)
  4. Built-in defaults

Environment variables always override YAML values.

YAML fields

  • hostname (default: 127.0.0.1; set 0.0.0.0 for Docker/reverse-proxy deployments)
  • port (default: 4003)
  • cors-allow-origin (default: disabled; set to a single origin or YAML list of origins for browser clients)
  • cors-allow-credentials (default: false; enable only with explicit allowed origins, never *)
  • auth-token (default: empty string) — a static bearer token for non-browser producers. When set, POST /logger requires an Authorization: Bearer <auth-token> header matching this value; requests without it are rejected with 401 Unauthorized. Leave empty to accept unauthenticated requests (the default). Note: the bundled DTaaS client posts events via navigator.sendBeacon, which cannot set custom headers, so enabling this setting will block ingestion from that client. Browser ingest security is delegated to the reverse proxy.
  • tls (default: false)
  • certs (default: ./certs)
  • log-file-path (default: ./logs/workflow-logs.jsonl)
  • max-payload-bytes (default: 65536)
  • log-max-bytes (default: 52428800)
  • log-retention-files (default: 5 rotated files)
  • throttle-ttl (default: 60000 milliseconds)
  • throttle-limit (default: 120 requests per throttle window)

A sample configuration is given below. Copy it into a file named logger.yaml, and update the values for your setup:

hostname: 127.0.0.1
port: 4003
# Restrictive same origin.
cors-allow-origin: http://localhost
# One external domain.
# cors-allow-origin: https://client.example.org
# Three external domains.
# cors-allow-origin:
#   - https://client-a.example.org
#   - https://client-b.example.org
#   - https://client-c.example.org
cors-allow-credentials: false
auth-token: ''
tls: false
certs: ./certs
log-file-path: ./logs/workflow-logs.jsonl
max-payload-bytes: 65536
log-max-bytes: 52428800
log-retention-files: 5
# Limits are per TCP peer; behind a reverse proxy this is a shared budget.
throttle-ttl: 60000
throttle-limit: 120

The same sample can also be downloaded:

curl -o logger.yaml \
  https://raw.githubusercontent.com/INTO-CPS-Association/DTaaS/feature/distributed-demo/servers/logger/config/logger.yaml.sample

Environment variables

  • LOGGER_CONFIG_PATH
  • LOGGER_HOSTNAME (default: 127.0.0.1; use 0.0.0.0 in containers)
  • LOGGER_PORT (default: 4003)
  • LOGGER_CORS_ALLOW_ORIGIN (default: disabled)
  • LOGGER_CORS_ALLOW_CREDENTIALS (default: false)
  • LOGGER_AUTH_TOKEN
  • LOGGER_TLS
  • LOGGER_CERTS_DIR
  • LOGGER_LOG_FILE_PATH (default: logs/workflow-logs.jsonl)
  • LOGGER_MAX_PAYLOAD_BYTES (default: 65536)
  • LOGGER_LOG_MAX_BYTES (default: 52428800)
  • LOGGER_LOG_RETENTION_FILES (default: 5)
  • LOGGER_THROTTLE_TTL (default: 60000 milliseconds)
  • LOGGER_THROTTLE_LIMIT (default: 120)

External authentication and edge rate limiting are provided by the reverse proxy in the deployment compose files. The service also applies an internal request throttle for callers that bypass the proxy.

The logger identifies callers by their TCP peer address and deliberately does not trust forwarded client-address headers. Behind Traefik, requests therefore share the proxy container's throttle budget. Set throttle-limit (or LOGGER_THROTTLE_LIMIT) high enough for the combined request volume of all expected users during throttle-ttl.

The service sends Access-Control-Allow-Credentials: true only when cors-allow-credentials is enabled. Credentials cannot be enabled with a wildcard CORS origin.

TLS support

Set tls: true (or LOGGER_TLS=true) to enable HTTPS.

Certificates are read from the configured cert directory:

  • <certs>/fullchain.pem
  • <certs>/privkey.pem

If either file is missing and TLS is enabled, the service auto-generates a self-signed certificate using OpenSSL with RSA-4096 + SHA-256 and stores the files in the certs directory.

Log storage format

Each request is appended as one JSON object per line (.jsonl). This format is append-efficient and can be queried directly:

jq -c '.event' logs/workflow-logs.jsonl

The active log rotates at log-max-bytes and keeps the configured number of rotated files. The defaults are 50 MiB and 5 rotated files, so capacity should allow for the active file plus those retained rotated files.

Log writes are best-effort analytics storage. Graceful shutdown closes the write stream, but recent events may be lost on hard container termination because writes are not fsynced per request.

:rocket: Use

Start the logger with the logger.yaml file in the working directory, or with the built-in defaults if there is no such file:

logger-ms

To use a configuration file at another location, run

logger-ms -c FILE-PATH
logger-ms --config FILE-PATH

The logger listens on http://127.0.0.1:4003/logger by default. You can press Ctrl+C to halt the application.

Use in Docker Environment

The logger is also available as the intocps/logger-ms docker image. Please see the docker instructions for running it.