Unattended installs

Ansible, CI, or a shell script: every question has a LOGHOUND variable behind it.

Every prompt can be pre-answered from the environment, whether or not the wizard is interactive, so one awkward answer can be seeded and the rest still asked.

sudo LOGHOUND_HOSTNAME=loghound.example.com \
     LOGHOUND_PANEL_USER=admin \
     LOGHOUND_PANEL_PASSWORD='...' \
     LOGHOUND_OPENSOLR_EMAIL=you@example.com \
     LOGHOUND_OPENSOLR_API_KEY='...' \
     LOGHOUND_OPENSOLR_REGION=FINLAND9 \
     LOGHOUND_IP_MODE=truncate \
     LOGHOUND_RETENTION_DAYS=90 \
     ./install/install.sh --non-interactive --tls-mode existing \
       --tls-cert /etc/letsencrypt/live/loghound.example.com/fullchain.pem \
       --tls-key  /etc/letsencrypt/live/loghound.example.com/privkey.pem

The API key is never echoed to the terminal and never written to the install log. The full list of variables is printed by the wizard itself:

bin/loghound-setup --help
01 · The variables
LOGHOUND_NONINTERACTIVE

Same as --non-interactive.

LOGHOUND_LOG_PATH

The access log path, when detection finds nothing.

LOGHOUND_CONFIRM_SOURCES

yes/no — accept the detected sources.

LOGHOUND_ALLOW_LOG_ROOTS

yes/no — allow a log directory outside allowed_log_roots.

LOGHOUND_OPENSOLR_EMAIL

The account email.

LOGHOUND_OPENSOLR_API_KEY

The API key. Never echoed, never logged, never printed back.

LOGHOUND_OPENSOLR_REGION

The region, and it applies only to indexes this run creates.

LOGHOUND_OPENSOLR_REUSE

new (the default) or an 8-hex installation id, to join a pair that already exists.

LOGHOUND_OPENSOLR_UPGRADE_SCHEMA

yes to allow fields this version writes to be added to an older pair. Without it, a mismatch stops the run and changes nothing.

LOGHOUND_RECONFIGURE_STORAGE

yes to settle storage again on a box that already has both indexes.

LOGHOUND_IP_MODE

full, truncate or hash. See privacy.

LOGHOUND_RETENTION_DAYS

Days of history to keep. See retention.

LOGHOUND_CONFIRM_RESET

yes/no — answers the --reset confirmation. Defaults to no, so an unattended run cannot wipe a working installation by tripping over the flag.

LOGHOUND_PREFIX

Install root, equivalent to --prefix.

LOGHOUND_IP_MODE and LOGHOUND_RETENTION_DAYS are overrides with no prompt behind them

Neither installer asks about privacy or retention, interactively or otherwise. Leave them out and the defaults stand — the full address, ninety days — changed afterwards in the panel. Either works on its own; the one you do not set keeps whatever the configuration already holds.

02 · There is no variable for a Solr address

Deliberately. The connection details come back from Opensolr and the two index names are generated, so an unattended install needs the account answers and nothing else about storage. No form, POST action or environment variable accepts a Solr address, HTTP credentials or a core name from the caller.

Re-running the wizard on a box that already has both indexes leaves them alone. To have a machine join a pair that already exists rather than creating two, give it the pair’s installation id — the eight hex characters in the middle of the index names, which the wizard prints before it asks:

sudo LOGHOUND_HOSTNAME=shop.example.com \
     LOGHOUND_OPENSOLR_EMAIL=you@example.com \
     LOGHOUND_OPENSOLR_API_KEY='...' \
     LOGHOUND_OPENSOLR_REUSE=aaaa1111 \
     ./install/install.sh --non-interactive

That is how several sites report into one pair; they are told apart in the panel by the hostname on every record. LOGHOUND_OPENSOLR_REUSE defaults to new, so an unattended re-run never adopts another site’s indexes merely because it found some.

--non-interactive switches on by itself when stdin is not a terminal

A wizard that blocks forever on a closed stdin is the worst possible failure mode inside an automated deploy. --interactive forces prompting back on if you want it.

Loghound is open source and MIT licensed. Questions about the Opensolr half — the account, the indexes, the plan — go to opensolr.com/contact; questions about the software itself belong on GitHub.

Loghound Documentation