# Logging to DB

**URL:** <https://www.ruby-forum.com/t/logging-to-db/207950>\
**Category:** NGINX\
**Created:** [June 6, 2011, 11:18pm UTC](https://www.ruby-forum.com/t/logging-to-db/207950 "2011-06-06T23:18:00Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![luislavena](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/l/0ea827/32.png) [@luislavena](https://www.ruby-forum.com/u/luislavena)\
**Post date:** [June 6, 2011, 11:18pm UTC](https://www.ruby-forum.com/t/logging-to-db/207950/1 "2011-06-06T23:18:00Z")

</div>

Is there any tried and tested way to log to a database?

There appears to be several options using fifo, syslog, etc floating  
around, however, there seems to be some issues with certain options.

Any pointers would be welcome.

Thanks,

John

---

<div class="post-metadata">

**Author:** ![John\_Macleod](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/j/a87d85/32.png) [@John\_Macleod](https://www.ruby-forum.com/u/John_Macleod)\
**Post date:** [June 7, 2011, 1:21pm UTC](https://www.ruby-forum.com/t/logging-to-db/207950/2 "2011-06-07T13:21:55Z")

</div>

On 06/07/11 01:17, John Macleod wrote:

> Is there any tried and tested way to log to a database?
> 
> There appears to be several options using fifo, syslog, etc floating  
> around, however, there seems to be some issues with certain options.

how to do this depend on acceptable delay.

If you need nearly real time info in DB:  
tail -F /var/log/access.log | /path/to/writer\_logs\_to\_db

If several minutes lag is acceptable, you can rotate logs and then load  
full log  
in single transaction.

–  
Anton Y.
