Log Analysis and Diagnostic Data Gathering Questions

Extracting signal from existing logs and diagnostic output to find a root cause: parsing and querying log data, correlating traces and metrics during an investigation, and gathering the right diagnostic information (including asking clarifying questions) before drawing conclusions. Covers text-processing and query techniques for locating evidence in logs (structured log parsing, ElasticSearch/SQL-style log queries, log aggregation and retention trade-offs) and reconstructing a timeline from the data on hand. This is the analysis-of-existing-data skill used during troubleshooting and investigation across infrastructure and operations roles: distinct from monitoring and observability, which is about instrumenting a system so telemetry exists in the first place (see the observability topics for that), and distinct from SIEM-based security detection and formal digital-forensics practice (chain of custody, artifact/disk/memory analysis), which have their own dedicated coverage elsewhere in the catalog.

MediumTechnical
30 practiced

Write an ElasticSearch DSL query or SQL (pick one and state it) that finds users who experienced more than five HTTP 500 responses within any 10-minute window in the last 24 hours. Assume an index/table 'http_logs' with fields: timestamp (UTC), user_id, status_code, endpoint. Provide the query and explain assumptions about timestamp normalization and log completeness.

EasyTechnical
37 practiced

Given a sample Apache access log line formatted without quotes:

127.0.0.1 - frank [10/Oct/2024:13:55:36 -0700] GET /index.html HTTP/1.1 200 2326

Write a single PCRE regular expression to extract the following named groups: client_ip, user, timestamp, method, path, protocol, status, bytes. Show how you'd run grep -P or awk to capture these fields and mention timestamp parsing caveats (timezones, format).

MediumTechnical
42 practiced

Write (or outline) a Python script that reads a large log file (streaming, may not fit in memory) of timestamped events where each line is: "ISO8601_TIMESTAMP LEVEL message". Implement an approach to identify the top-3 sliding 5-minute windows with the highest error (LEVEL=ERROR) rate and report window start, end, and error count. Explain complexity and streaming constraints.

EasyTechnical
32 practiced

On a typical Linux system, where are system and application logs stored by default and what are the differences between text-based files under /var/log and the systemd journal? Include example commands to:

  • View the last 100 lines of a file-based log
  • Show logs for a specific systemd unit since yesterday
  • Follow a log file in real time

Explain when one source may contain entries the other does not and the implications for incident response.

MediumTechnical
30 practiced

Coding task in Python: build a memory-efficient utility that reads multiple large newline-delimited JSON log files and extracts, in chronological order, all events that have a given request_id between two timestamps. The function signature should be extract_events(file_paths, request_id, start_ts, end_ts) and must stream files without loading them entirely into memory. Describe edge cases you would handle in production.

Unlock Full Question Bank

Get access to all 12 Log Analysis and Diagnostic Data Gathering interview questions and detailed answers.

Sign in to Continue

Join thousands of developers preparing for their dream job.