Dataford
Interview QuestionsInterview GuidesExperiencesMock InterviewsPricing
Get started
Dataford
Popular roles
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Browse
Browse All RolesEvery role hub, from analyst to MLBrowse All CompaniesCompany-specific interview loopsAll Interview GuidesThe full guide library
Top questions by role
Software EngineerData AnalystData ScientistData EngineerBusiness AnalystAI EngineerMachine Learning EngineerProduct Manager
Top questions by skill
SQLPythonStatisticsMachine LearningA/B TestingSystem DesignGenerative AIProduct SenseMetricsBehavioral
Browse all questions →Try a mock interview
Experiences
Practice
Mock InterviewsTimed interview simulations with feedbackSuccess PathYour 6-week structured planModulesCurated lessons by topicWebinarsTalks from ex-Big Tech data leadsPlaygroundA free-form scratch editor
Learn
BlogInterview strategy and career adviceTech Job Market ReportHiring trends across data and AI rolesFor UniversitiesDataford for career centersAbout DatafordWho we are and how we build
Pricing
Build my plan
Extract KPIs from Unstructured Logs
00:00
5 left

Extract KPIs from Unstructured Logs

MediumSQL · PostgreSQL

Problem

Write a script to parse unstructured log data and extract key performance indicators for a software release.

Use the provided release and log tables. Extract status codes and latency values from log messages, treating missing or malformed values as NULL.

Output

  1. One row per release, including releases with no matching logs.
  2. Columns: release_id, version, total_events, successful_events, error_events, error_rate_pct, avg_latency_ms, and p95_latency_ms.
  3. Count 2xx and 3xx statuses as successful, 5xx statuses as errors, and order by release_id ascending.

Schema

software_releases
ColumnTypeDescription
release_idPKINTUnique release identifier
versionVARCHAR(30)Release version label
release_dateDATEDate the release became available
release_logs
ColumnTypeDescription
log_idPKINTUnique log record identifier
release_idINTRelease associated with the log
logged_atTIMESTAMPTime the log event occurred
log_messageTEXTUnstructured event log text
Tablessoftware_releasesrelease_logs
Interviewer

Your question is Extract KPIs from Unstructured Logs. Start with the requirements and the two tables in the Question tab.

Run and submit as often as you like. When you're ready, talk me through your approach or go straight to the code.

You need to log in / sign up to run or submit.
CodePostgreSQL
Sign up free to run your codeLog inLn 1
Run your query to see results here.