PracHub
QuestionsPremiumCoachesLearningGuidesInterview Prep
|Home/System Design/Google

Design log management with auto-deletion

Last updated: Mar 29, 2026

Quick Overview

This question evaluates a candidate's ability to design a bounded in-memory log buffer with prioritized eviction, testing knowledge of data structures, tie-breaking policies, time/space complexity, and deterministic handling of arrival timestamps.

  • medium
  • Google
  • System Design
  • Software Engineer

Design log management with auto-deletion

Company: Google

Role: Software Engineer

Category: System Design

Difficulty: medium

Interview Round: Technical Screen

##### Question Design a log management system that ( 1) keeps the total number of logs ≤ total_max, ( 2) automatically deletes the least important or oldest logs when adding new ones to stay within limits, and ( 3) locates logs to delete in O( 1) time using appropriate data structures (e.g., time-ordered deque plus priority heap).

Quick Answer: This question evaluates a candidate's ability to design a bounded in-memory log buffer with prioritized eviction, testing knowledge of data structures, tie-breaking policies, time/space complexity, and deterministic handling of arrival timestamps.

Related Interview Questions

  • Design a Security Monitoring Framework - Google (medium)
  • Design an Online Coding Judge Platform - Google (medium)
  • Design Calendar Event Conflict Handling - Google (medium)
  • Design a pub-sub replay system - Google (hard)
  • How to host many domains on one IP? - Google (medium)
Google logo
Google
Aug 4, 2025, 10:55 AM
Software Engineer
Technical Screen
System Design
4
0

Design a Bounded Log Management System with O(1) Victim Selection

Context

You are designing an in-memory log buffer that ingests log entries and must never exceed a configured capacity (total_max). Each log has:

  • id (unique)
  • timestamp (arrival time; assume non-decreasing or we treat arrival time separately from event time)
  • importance (integer; lower means less important)
  • payload (opaque)

When the buffer is full and a new log arrives, the system should automatically evict logs to stay within capacity, preferring to remove the least important logs; ties are broken by oldest timestamp.

Requirements

  1. Maintain total number of logs ≤ total_max at all times.
  2. On insert, automatically delete logs to make room, preferring:
    • Lowest importance first, and if there’s a tie,
    • Oldest by arrival timestamp.
  3. Locate the next log to delete in O(1) time (e.g., via a time-ordered deque and a min-priority heap). Overall update/eviction cost can exceed O(1) due to necessary re-indexing.

Deliverables

  • Describe the core data structures and how they interact.
  • Specify insertion and eviction algorithms and their time/memory complexity.
  • Include assumptions, tie-breaking rules, and handling of out-of-order timestamps.
  • Provide concise pseudocode for key operations.

Solution

Show

Submit Your Answer to Earn 20XP

Sign in to leave a comment

Loading comments...

Browse More Questions

More System Design•More Google•More Software Engineer•Google Software Engineer•Google System Design•Software Engineer System Design
PracHub

Master your tech interviews with 8,000+ real questions from top companies.

Product

  • Questions
  • Learning Tracks
  • Interview Guides
  • Resources
  • Premium
  • For Universities
  • Student Access

Browse

  • By Company
  • By Role
  • By Category
  • Topic Hubs
  • SQL Questions
  • Compare Platforms
  • Discord Community

Support

  • support@prachub.com
  • (916) 541-4762

Legal

  • Privacy Policy
  • Terms of Service
  • About Us

© 2026 PracHub. All rights reserved.