✨ From vibe coding to vibe deployment. UBOS MCP turns ideas into infra with one message.

Learn more
Andrii Bidochko
  • Updated: January 18, 2026
  • 6 min read

Introducing History Collector (hc): Open‑Source Service for Centralized System Logs

History Collector (hc) is an open‑source, lightweight service that centralizes shell command history from distributed servers into a PostgreSQL backend, providing a secure, agent‑less, multi‑tenant sink that can be queried with simple grep‑friendly HTTP endpoints.

History Collector (hc) — The “Boring” Shell‑History Sink That Powers Modern DevOps Teams

History Collector architecture diagram
Figure 1: High‑level architecture of the History Collector service.

Managing dozens or hundreds of Linux boxes means juggling countless .bash_history files. When a critical command disappears in the noise, teams waste precious minutes hunting through SSH sessions. The History Collector project (often abbreviated as hc) solves this problem by turning every shell command into a centrally stored, immutable record that can be retrieved instantly via a simple HTTP GET. It is built in Go, stores data in PostgreSQL, and follows a strict “no‑UI, no‑analytics, just history” philosophy—exactly what busy developers need.

Why Use History Collector? Core Benefits & Features

  • Agentless ingestion: Only curl, wget or socat are required on the client side—no extra binaries to maintain.
  • SSL‑native transport: TLS encryption protects every command in transit; client‑certificate and API‑key authentication are supported out of the box.
  • Multi‑tenant isolation: Each tenant is identified by an API key, keeping histories separate for teams, environments, or projects.
  • Grep‑friendly export: History is served as plain text, preserving the exact ingestion format, so you can pipe it directly into grep, awk, or any custom script.
  • Append‑only PostgreSQL store: Guarantees immutability, auditability, and easy integration with existing analytics pipelines.
  • Spool fallback: A lightweight append‑only file acts as a safety net during brief DB outages.

Technical Architecture & Supported Ingestion Formats

The service follows a clear separation of concerns:

TCP/TLS  →  hc (ingestion listener)  →  Spool file (per‑tenant)  →  PostgreSQL (authoritative)  →  HTTP/HTTPS export (plain text)

Ingestion listeners:

  • plain TCP – for trusted internal networks (clear‑text).
  • TLS – recommended for any production environment; supports client‑certs and API‑key auth.

Supported shells include Bash, BusyBox ash, and any POSIX‑compatible shell that can emit a single‑line record. The required line format is:

YYYYMMDD.HHMMSS - SESSIONID - host.example.com [cwd=/path] > command args

When an API key is used, it is wrapped like ]<apikey>[hc_9f3a1c2d.QmFzZTY0U2VjcmV0] command and stripped before storage.

API‑Key Management & Client‑Side Setup

API keys are the primary tenant identifier. They are generated via the api_key verb:

./hc.app api_key \
  -config hc-config.json \
  -api_tenantid 11111111-1111-1111-1111-111111111111 \
  -api_userid 00000000-0000-0000-0000-000000000001

The command returns a key_id and a secret token (shown only once). Store it securely; the secret never appears again.

Example Bash hook (TLS + API key)

export SESSION_ID_HC=$(date +%Y%m%d.%H%M%S | sha1sum | cut -c1-8)
export APIKEY_HC="hc_9f3a1c2d.QmFzZTY0U2VjcmV0"
export PROMPT_COMMAND='echo "$(date +%Y%m%d.%H%M%S) - ${SESSION_ID_HC} - $(hostname --fqdn) [cwd=$(pwd)] > ]apikey[${APIKEY_HC}] $(history -w /dev/stdout | tail -n1)" \
  | socat - OPENSSL:hc.example.com:1235,verify=0'

For environments without TLS, a plain nc call works the same way, but you lose encryption. The hook can be placed in ~/.bashrc or /etc/profile.d for system‑wide coverage.

Deployment Checklist: PostgreSQL Schema, Firewalls & NAT

PostgreSQL schema

The pg_schema.sql file creates four tables:

  • tenants – logical isolation units.
  • cmd_events – immutable command records.
  • api_keys – hashed keys for authentication.
  • app_users – optional user metadata for future extensions.

Initialize with:

createdb history
psql history < pg_schema.sql

Firewall & NAT handling

In many enterprises the collector sits behind a strict firewall. The project ships an example.bash script that creates a reverse SSH tunnel from the target host back to the collector, allowing ingestion without opening inbound ports. The workflow is:

  1. SSH into the remote host from a bastion.
  2. Run the tunnel script; it forwards a local port on the remote host to the collector’s TLS listener.
  3. The PROMPT_COMMAND hook then writes to localhost:PORT, which is tunneled securely.

This “zero‑touch” approach satisfies compliance teams that forbid installing extra daemons on production servers.

Project Status, Roadmap & Community Philosophy

As of the latest release (v0.3, May 2024), the following milestones are marked green:

  • Plain + TLS ingestion
  • PostgreSQL storage
  • API‑key authentication
  • HTTP & HTTPS export (plain‑text)

Work in progress includes:

  • SQLite backend for lightweight edge deployments.
  • Optional web UI for quick browsing (non‑core, optional).
  • Full client‑certificate auth flow.

The maintainers stress that History Collector is not a SIEM, not a real‑time analytics engine, and not a UI‑heavy product. Its purpose is to be a reliable, inspectable, and “boring” sink that developers can trust. Contributions are welcomed via pull requests; the project follows a permissive GPL‑3.0 license, encouraging both individual and commercial use.

“Our philosophy is to keep history collection simple, immutable, and grep‑ready. If you need dashboards, build them on top of the data you already have.” – Project Lead

How History Collector Fits Into the UBOS Ecosystem

UBOS provides a modular AI‑first platform for building, deploying, and scaling SaaS applications. The UBOS platform overview includes a Workflow automation studio that can ingest the PostgreSQL tables created by hc and trigger downstream AI agents.

For example, you could connect the AI marketing agents to analyze command trends and surface risky patterns (e.g., repeated rm -rf / attempts). The UBOS templates for quick start include a “Shell History Dashboard” template that reads from the cmd_events table and visualizes command frequency over time.

Startups can spin up a fully managed History Collector instance via the UBOS for startups program, while SMBs benefit from the UBOS solutions for SMBs that bundle storage, backup, and compliance monitoring.

Get Started Today

Ready to bring order to your command history? Follow these steps:

  1. Visit the UBOS homepage and sign up for a free trial.
  2. Clone the repository: git clone https://github.com/alessandrocarminati/hc.git (see the official GitHub repo).
  3. Deploy the PostgreSQL schema using the provided pg_schema.sql.
  4. Configure hc-config.json to match your network and TLS certificates.
  5. Generate an API key with ./hc.app api_key … and add the hook to your shell profile.
  6. Use the HTTP export endpoint to pipe history into your own analytics or the AI SEO Analyzer for quick insights.

Need help? Join the UBOS partner program for dedicated onboarding, or explore the UBOS portfolio examples to see real‑world deployments.


Andrii Bidochko

CTO UBOS

Andrii Bidochko is an AI entrepreneur and researcher focused on AI agents, reinforcement learning, and autonomous systems. He writes about the technologies shaping the future of machine intelligence, from frontier models and agent architectures to real-world AI applications.

Sign up for our newsletter

Stay up to date with the roadmap progress, announcements and exclusive discounts feel free to sign up with your email.

Sign In

Register

Reset Password

Please enter your username or email address, you will receive a link to create a new password via email.