Server Logs, Monitoring, Health, Elasticsearch, and Operational Diagnostics: Core Concepts and Mental Model
Operate SonarQube from process-specific evidence: follow scanner reports through web, Compute Engine, database, search, and UI/API visibility instead of treating one green screen as whole-system health.
Learning objectives
- Trace scanner request/report → web/API → Compute Engine queue/task → database persistence → search indexing → UI/API visibility.
-
Map
sonar.log,web.log,ce.log,es.log,access.log, and the deprecation log to the process or request layer they actually describe. - Distinguish server availability, global health, CE queue health, individual task status, project Quality Gate state, and search freshness.
-
Use
api/system/health,api/system/status, CE APIs, and monitoring metrics with the correct authentication/permission boundary. - Explain why DEBUG/TRACE logging is a short diagnostic instrument rather than a permanent monitoring strategy.
- Keep Elasticsearch and the SonarQube database inside their supported ownership boundaries—observe and recover them without direct state edits.
1. The practical problem: “the UI opens” is only one signal
Chapters 6 through 26 repeatedly separated scanner success, report
upload, ceTaskId, Compute Engine completion, analysis
result, Quality Gate, CI status, and provider decoration. Chapter 27
turns that evidence chain into an operating model for the server
itself.
A browser can render the SonarQube home page while the Compute
Engine queue is backed up. A scanner can print
EXECUTION SUCCESS while its uploaded report later fails
in Compute Engine. The database can accept web requests while the
search engine is under disk pressure. A Quality Gate can remain
green because it reflects the last completed analysis even though
the newest task is pending or failed. Operational diagnosis
therefore starts by naming the subsystem and timestamp, not by
asking whether “SonarQube is up.”
revision + scanner context → report upload → ceTaskId / CE queue
→ DB persistence → Elasticsearch indexing → project
measures/issues/gate → UI/API visibility
2. Mental model: one analysis crosses multiple owning processes
flowchart TD
A["Scanner process"] -->|"analysis report"| B["Web server / API"]
B --> C["CE queue"]
C --> D["Compute Engine task"]
D --> E[("SonarQube database")]
D --> F["Embedded Elasticsearch"]
E --> G["Project state"]
F --> G
G --> H["UI / Web API"]
B -. "web.log" .-> L1["Process evidence"]
D -. "ce.log" .-> L1
F -. "es.log" .-> L1
A -. "scanner log + report-task.txt" .-> L1
The scanner does local indexing/analyzer work and uploads a report. The web process receives HTTP/API traffic and interacts with the database/search layer for request handling. Compute Engine consumes queued background tasks and turns the uploaded report into persisted analysis state. Elasticsearch serves indexed/search-oriented views. If any transition fails, the later stage cannot be inferred from the earlier one.
3. Current server logs: identify the owner before reading noise
| File | Owning layer | Typical evidence |
|---|---|---|
sonar.log |
Main/bootstrap process | Overall startup/shutdown and process-launch status; use child-process logs for detail. |
web.log |
Web server | Database connection/migration/reindexing, HTTP request processing, request-related database/search failures. |
ce.log |
Compute Engine | Background task execution, report processing, CE-side database/search failures, task IDs and timings. |
es.log |
Embedded Elasticsearch | Search startup, health-state changes, cluster/node/index operations, disk-watermark symptoms. |
access.log |
HTTP access layer | Inbound request path/status/timing metadata according to the configured pattern. |
| API deprecation log | Web API compatibility | Requests that still use deprecated endpoints or parameters—important before upgrades. |
On ZIP installs the files live under
<sonarqubeHome>/logs by default. Container
deployments can preserve the same files on a mounted logs volume and
may also expose stdout/stderr. Capture timestamps and the server’s
time zone when correlating scanner, CI, container, database, and
host logs.
4. Health, status, queue, and gate are different dimensions
api/system/status
Basic application lifecycle/status signal. Useful during startup, but not a substitute for CE/search/DB diagnostics.
api/system/health
Returns GREEN/YELLOW/RED global health. Current API requires Administer System or a configured system passcode.
CE activity/task
Shows whether a specific ceTaskId is PENDING,
IN_PROGRESS, SUCCESS, FAILED, or canceled and whether queue
latency is growing.
Quality Gate
Policy result for a completed analysis. It says nothing about a newer task that has not completed.
That distinction is essential during incidents: a GREEN system health response can coexist with one project’s failed CE task; a RED or YELLOW system signal can be unrelated to a project’s source code; and a green gate can simply be stale.
5. Metrics complement logs; they do not replace them
Current Community Build exposes OpenMetrics-formatted monitoring
data at /api/monitoring/metrics. Monitoring
authentication is intentionally separate from ordinary project API
calls and can use the system passcode configured through
sonar.web.systemPasscode/SONAR_WEB_SYSTEMPASSCODE. Kubernetes deployments can
additionally expose CE/Web JMX metrics through the supported
Prometheus integration.
Use metrics to answer how much and how often: queue
depth/latency, JVM memory, CPU, disk, request rates, database pool
pressure. Use logs and task records to answer
which operation failed and why. A graph tells you when CE
latency rose; ce.log and the failed task’s error detail
tell you which report or dependency caused the incident.
6. Resource domains: three Java processes plus shared dependencies
Community Build has three main Java processes: Web, Compute Engine, and Elasticsearch. Each has independent memory behavior. The database is an external dependency in production, and the host/container adds CPU, RAM, file-descriptor, process/thread, and disk constraints.
| Symptom | First owning evidence | Do not jump to |
|---|---|---|
| Slow UI/API |
web.log, access timings, web JVM/CPU, DB pool,
search request errors
|
Restarting CE or changing a Quality Gate |
| Growing analysis queue |
CE activity, ce.log, CE JVM/CPU, task duration
distribution
|
Increasing worker count before proving capacity/cause |
| Search errors/read-only indices | es.log, disk usage, system health |
Direct Elasticsearch API/index edits |
| DB connection exhaustion |
web.log/ce.log, database metrics,
HikariCP errors
|
Deleting search data or changing project configuration |
| One failed project task |
ceTaskId, scanner context, task error details,
ce.log
|
Server-wide restart without evidence |
7. Elasticsearch is embedded, owned state—not an operator playground
SonarQube uses embedded Elasticsearch as part of its application
architecture. Treat it as SonarQube-owned state. Diagnose through
es.log, supported health/monitoring surfaces, disk/IO
evidence, and SonarSource recovery procedures. Do not “repair” a
SonarQube incident by issuing arbitrary Elasticsearch cluster/index
mutations or deleting search directories.
Current Sonar guidance documents disk watermarks: warnings begin before the critical threshold, and at roughly 95% used disk non-Data-Center installations can put indices into read-only mode. After freeing space, the supported non-DCE recovery includes restarting SonarQube so indices return to read/write. The safe causal sequence is preserve logs → prove disk pressure → free space safely → follow documented recovery → verify health.
8. DEBUG and TRACE are temporary diagnostic states
INFO is the default server log level.
DEBUG adds advanced information and can include
personal user information. TRACE includes very detailed
SQL/Elasticsearch request information, can slow the server, and can
grow logs rapidly. Current SonarQube lets an administrator change
log level temporarily from Administration → System; that temporary
choice resets at restart.
app, web,
ce, or es), bound the capture duration,
restrict log access, and return to INFO immediately after
reproduction. Never leave TRACE enabled as a substitute for
monitoring.
9. Read-only inspection first
# Scanner-side identity
sonar-scanner --version
git rev-parse HEAD
cat .scannerwork/report-task.txt
# Public/basic lifecycle endpoint (availability depends on auth policy)
curl -fsS "$SONAR_HOST_URL/api/system/status"
# Admin/system-passcode health request; do not put the passcode in source.
curl -fsS -H "X-Sonar-Passcode: $SONAR_SYSTEM_PASSCODE" \
"$SONAR_HOST_URL/api/system/health"
# Correlate one uploaded task with its server state.
curl -fsS -H "Authorization: Bearer $SONAR_API_TOKEN" \
"$SONAR_HOST_URL/api/ce/task?id=$CE_TASK_ID"
# Container lab: preserve process-specific logs before changing anything.
docker cp sq-ch27:/opt/sonarqube/logs/. evidence/logs-before/
The goal is not to collect everything forever. The goal is to preserve the smallest evidence set that can prove ownership, timing, and causal order.
Knowledge check
A scanner reports EXECUTION SUCCESS but the project page does not update. Which state is missing?
The uploaded report still needs a successful Compute Engine
background task. Inspect
report-task.txt/ceTaskId, task status,
and ce.log.
Why can a green Quality Gate be stale during a CE incident?
The gate belongs to the last completed analysis. A newer uploaded task can still be pending or failed.
Which log is the primary place for a failed background analysis task?
ce.log, correlated with the task ID and scanner
context. Web/search/DB evidence may then be needed if CE points
there.
Is api/system/health an anonymous production
health endpoint?
No. Current API requires Administer System or a configured system passcode.
Why not fix an Elasticsearch symptom by editing indices directly?
Elasticsearch is SonarQube-owned application state. Direct mutations bypass supported consistency/recovery mechanisms and can turn a diagnosable incident into data corruption.
Official references and version notes
- Community Build — Server logs — current process-specific files, log levels, rotation, JSON output, DEBUG/TRACE privacy/performance cautions.
-
Community Build — Monitoring the instance
—
api/system/health, Web/CE/Elasticsearch JVMs, CPU/RAM/disk monitoring. -
Community Build — Monitoring on Kubernetes
—
/api/monitoring/metrics, OpenMetrics, and CE/Web JMX exporter model. - Community Build — Web API — bearer authentication, system-passcode use for monitoring, and continuing Web API V2 transition.
-
Current Web API reference —
api/system/health— GREEN/YELLOW/RED semantics and Administer System/system-passcode requirement. - Current Web API reference — Compute Engine — CE activity/task APIs and permission boundaries.
- Background tasks — scanner success vs CE completion, task failure diagnosis, and project/module key-clash example.
- Community Build — Elasticsearch-related issues — disk-watermark/read-only behavior and supported recovery.
- Community Build — Database-related issues — HikariCP timeout/exhaustion evidence and supported connection-pool tuning.
- Community Build — Installing database — supported production DB engines/versions and evaluation-H2 boundary.
- SonarScanner CLI 8.1.0.6389 — current CLI baseline.
- SonarScanner for Maven 5.7.0.6970 — current Maven scanner baseline used by the optional key-clash failure fixture.
Rechecked 2026-09-08. Mandatory examples target SonarQube
Community Build 26.9.0.129388 and SonarScanner
CLI 8.1.0.6389; the Maven failed-task fixture
uses SonarScanner for Maven 5.7.0.6970. Current
commercial reference is SonarQube Server 2026 Release 4.1 with
2026.1.5 LTA. Current Community Build logs are
sonar.log, web.log, ce.log,
es.log, access and API-deprecation logs.
api/system/health requires Administer System or
system passcode; /api/monitoring/metrics exposes
OpenMetrics under its monitoring-auth boundary. Community Build
has Web, CE and embedded Elasticsearch JVMs; production databases
must use supported PostgreSQL/SQL Server/Oracle rather than the
evaluation H2 database. The project/component key-clash failure is
documented as a CE failure class, but exact scanner versions may
prevalidate the conflict before upload; the lessons explicitly
preserve that layer distinction rather than forcing unsafe
database/search failures.
Keep the academy open
Support free, practical DevOps education.
Every lesson is designed to remain readable in a browser, downloadable from GitHub, and usable without a paid learning platform. Contributions help expand and maintain the curriculum.
0x716c4Ab160C4B66F31a28AE2448BfF68fc3a2ef0Send only Ethereum/ERC-20 compatible assets to this
address.