Estimate the scale of the system. Consider daily active users, read/write ratio, storage requirements, bandwidth, and any relevant QPS calculations...
The logs in cold storage would reside in S3 storage in parquet format for size optimization.
The Postgres database needs to be indexed correctly based upon the search. Based upon the search. That needs to be performed if the search is going to be something structured like based upon timestamps based upon the log types like warnings or the health. Or maybe. Errors then post uh, creating indexes based upon. Serve creating composite indexes based upon the service. The error and the error type or the warning type? Warning or actual log info basically would help speed up the search especially. From, instead of having to search over 2 billion rows, it could be brought down to millions or so rows, or even lower. That is 1 optimization that can be done on the read path.
And usage of Kafka stream even stream decouples our writes from the actual. Uh, logging portion of it, meaning that. Once we write our events into the Kafka event stream, we have durability lasting up to even a week and. The logging system. The service that is calling the logging. Umm, logger basically need not wait until the write is successful, and need not wait until it gets an acknowledgement from. In our database write database stating that the write has been successful. That can be it's own process from the Kafka event stream. And to avoid duplicate logging entries each logger event will have a unique ID which is transmitted all the way downstream.