title: Routing Python Logs to Databases Efficiently
body: <p>I want to route some logs from my application to a database. Now, I know that this isn't exactly the ideal way to store logs, but my use case requires it.</p>
  <p>I have also seen how one can write their own database logger as explained here,
  <br>
  <a href="https://stackoverflow.com/questions/2314307/python-logging-to-database">python logging to database</a></p>
  <p>This looks great, but given that a large number of logs are generated from an application, I feel like sending as many requests to the database could maybe overwhelm it? It may not be the most efficient solution?</p>
  <p>Given that this argument is correct, what are some efficient methods for achieving this?</p>
  <p>Some ideas that come to mind are,</p>
  <ul>
  <li>Write the logs out to a log file during application run time and develop a script that will parse the file and make bulk inserts to a database.</li>
  <li>Build some kind of queue architecture that the logs will be routed to, where each record will be inserted to the database in sequence.</li>
  <li>Develop a type of reactive program, that will run in the background and route logs to the database.</li>
  <li>etc.</li>
  </ul>
  <p>What are some other possibilities that can be explored? Are there any best practices?</p>