Log Block Model - Individual log data block management within streaming log systems.
This model represents a single block of log data within a LogStreamModel, providing efficient
memory management and organized access to log lines. Log blocks are the fundamental storage
units that enable high-performance log streaming by breaking large log streams into
manageable, sequential segments with precise line numbering and timing information.
Memory-efficient Log Storage - Break large log streams into manageable blocks
Sequential Log Access - Navigate through log history by block
Selective Loading - Load only needed blocks for performance
Log Line Management - Add, retrieve, and manage individual log entries
Time-based Log Analysis - Filter and analyze logs by time ranges
Stream Synchronization - Keep log blocks synchronized with source streams
Example: Basic Usage
// Typically accessed through LogStreamModel, not created directly constlogStream = LogStream.instance('app-logs') .options({ name:'application-logs', nodeId:'primary' }) .build();
awaitlogStream.load();
// Access blocks within the stream constblocks = logStream.blocks; constcurrentBlock = logStream.currentBlock;
if (currentBlock) { console.log(`Block ${currentBlock.blockNum}`); console.log(`Lines: ${currentBlock.startLineNum}-${currentBlock.endLineNum}`); console.log(`Time range: ${currentBlock.startTime} to ${currentBlock.endTime}`); console.log(`Line count: ${currentBlock.lineCount}`); }
console.log(`Found ${blocksInRange.length} blocks in date range`);
// Process error logs from specific blocks for (constblockofblocksInRange) { awaitblock.syncLines(); // Ensure lines are loaded consterrorLines = block.lines .map((line, index) => ({ line, lineNum:block.startLineNum + index })) .filter(({ line }) =>line.includes('ERROR')); if (errorLines.length > 0) { console.log(`Block ${block.blockNum} has ${errorLines.length} errors`); errorLines.forEach(({ line, lineNum }) => { console.log(`Line ${lineNum}: ${line}`); }); } }
Example: Block Container Integration
// Access blocks through their container constlogStream = LogStream.instance('debug-logs').build(); constblockContainer = logStream.blocks; // This is a LogBlockContainerModel
// Blocks are automatically sorted by block number constsortedBlocks = blockContainer.data; console.log(`Stream has ${sortedBlocks.length} blocks`);
// Get specific block by ID constblockId = 'debug-logs-block-5'; constspecificBlock = blockContainer.getModel(blockId);
if (specificBlock) { console.log(`Block ${specificBlock.blockNum} loaded`); awaitspecificBlock.syncLines(); }
Log Block Model - Individual log data block management within streaming log systems.
This model represents a single block of log data within a LogStreamModel, providing efficient memory management and organized access to log lines. Log blocks are the fundamental storage units that enable high-performance log streaming by breaking large log streams into manageable, sequential segments with precise line numbering and timing information.
Key Features
Architecture Relationship
LogBlock works as a component within the broader log streaming architecture:
Common Use Cases
Example: Basic Usage
Example: Block Line Management
Example: Block Analysis and Filtering
Example: Block Container Integration
Example: Block Update and Synchronization
Use Declared Type
See