System requirements
Please design and develop a logging system. It's a central application that one can find and view logs generated by the target application.
We can use this logging system to:
collect logs
search logs (based on time and logging level)
view logs
Problem to resolve
FOR JUNIOR engineers:
How to collect logs (sync/async ? poll or push ?)
Sync: how to process failures of sending logs ?For different log formats, how to resolve ? (design pattern)
Do logs need to persist ?
limited to Database related, no ELK etc.
Table design, primary key(sequence or uuid ?), log content too long, etcWhat APIs to expose ?
RESTful, Data structures, HTTP status, input validation/Error handlingHow to search quickly ?
Index, note logs are time-series dataHow to deal very stale data ?
FOR SENIOR/EXPERT engineers:
In a distributed application, how to improve the performance of logging collecting ?
Messaging queueMessaging: How to avoid duplicate logs if messaging queue used ?
Scaling: How to find the performance bottleneck ? how to scale out ?
add service instances, load balancer
How to improve database performance ? (read-write separation or sharding (consider its time-based data)High availability (fix single point failure)
How to deal very stale data in a distributed system ?