Implementation:Apache Druid ShowLog
| Knowledge Sources | |
|---|---|
| Domains | Web_Console, Task_Monitoring |
| Last Updated | 2026-02-10 10:00 GMT |
Overview
ShowLog is a class-based React component that fetches and displays log output from a Druid API endpoint with optional tail-following, download, copy, and raw-view capabilities.
Description
The component uses a QueryManager to fetch log data from the specified endpoint, supporting a tail offset parameter to fetch only the last portion of large log files. When tail mode is enabled, it polls the endpoint at a configurable interval (default 2500ms) and auto-scrolls the textarea to the bottom to follow new log output. The first partial line is stripped when using tail offset to avoid displaying truncated content. The component provides buttons for downloading the full log, copying to clipboard, and opening the raw log endpoint in a new tab.
Usage
Used in the Druid web console's task detail views to display indexing task logs, supervisor logs, and other process output with live tail-following for active tasks.
Code Reference
Source Location
- Repository: Apache Druid
- File: web-console/src/components/show-log/show-log.tsx
- Lines: 1-209
Signature
export interface ShowLogProps {
endpoint: string;
downloadFilename?: string;
tailOffset?: number;
tail?: boolean;
}
export interface ShowLogState {
logState: QueryState<string>;
tail: boolean;
}
export class ShowLog extends React.PureComponent<ShowLogProps, ShowLogState> {
static CHECK_INTERVAL: number;
}
Import
import { ShowLog } from './components/show-log/show-log';
I/O Contract
Inputs
| Name | Type | Required | Description |
|---|---|---|---|
| endpoint | string | Yes | The Druid API endpoint URL path to fetch log content from |
| downloadFilename | string | No | If provided, enables a download anchor linking to the log endpoint |
| tailOffset | number | No | The number of bytes from the end to fetch (appended as ?offset=-N to the URL) |
| tail | boolean | No | When true, enables the tail-following toggle and starts periodic polling |
Outputs
| Name | Type | Description |
|---|---|---|
| JSX.Element | div | A container with a tail toggle switch, action buttons, and either a Loader, special instructions, or a read-only textarea displaying log content |
Usage Examples
Tailing a task log
<ShowLog
endpoint={`/druid/indexer/v1/task/${taskId}/log`}
downloadFilename={`task-log-${taskId}.log`}
tailOffset={16384}
tail
/>