List non-functional requirements for the system...
Estimate the scale of the system you are going to design...
POST /log # to send logs into the system
{
}
# To manage configured rules for log parsing.
POST /rule -> rule-id
{
}
DEL /rule?rule-id=:rule-id
GET /rules[?service=:service] -> Rules[]
GET /logs?startTime=:start&endTime=:end&service=:service[&cursor=:cursor][&hostname=:hostname]
POST /query
{
where_clause: List of List of Query-Expressions (or of ands)
select_clause: List of attributes (including aggregations)
}
Logs (emitted by applications)
Log-Schemas (configured)
End points send logs into Kafka where they are persisted in their raw form for up to seven days. These logs are picked up from Kafka by log processors which apply the passing rules from the rules, database to extract metrics and attributes from each log message. Those metrics in attributes are stored in Cassandra.
query, clients configure, passing rules via the front end, which are stored in a postgres database. They can also issue queries that are served by the query engine by reading from Cassandra and doing the appropriate aggregations according to the select and where clause.
We are using postgres to store the rules. This should not require very high scale. We don't expect more than a few hundred rules and rules change rarely.
We are using Kaka to persist the raw logs and provide the decoupling between ingesting and processing in case of spikes. Consumer groups are configured in logprocessors to pick up these raw logs and store them in Cassandra. We create secondary index in Cassandra as per the rules DB to make query easier. The queries are done by the front end using CQL, including processing of where and select classes
Explain how the request flows from end to end in your high level design. Also you could draw a sequence diagram using the diagramming tool to enhance your explanation...
Dig deeper into 2-3 components and explain in detail how they work. For example, how well does each component scale? Any relevant algorithm or data structure you like to use for a component? Also you could draw a diagram using the diagramming tool to enhance your design...
Explain any trade offs you have made and why you made certain tech choices...
Try to discuss as many failure scenarios/bottlenecks as possible.
What are some future improvements you would make? How would you mitigate the failure scenario(s) you described above?