Recording logs directly on database (logger.conf)

I would like to store my asterisk logs (logger.conf) (console, messages, full) directly on my SLQ database.

Does asterisk have any native suport that do that, like cdr_mysql.conf, cdr_pgsql.conf, cdr_odbc.conf… but for logger.conf?

No, there is no ability to do that.

Any chance for us to see it in the nearby future?

I know of noone working on this functionality and direct recording to database has not been something I’ve seen anyone ever request.

Is there a protocol that I have to follow to ask for this feature? Can I ask for this?

We don’t accept feature requests on the issue tracker as of this time, if you’d want to see this done you’d need to try to elicit interest from someone to write it or propose a bounty.

Indirectly you might be able send your syslog to a database, but I have no experience with that. Asterisk can send the logging to syslog. I will say that storing things in a database comes at a cost - the I/O performance is drastically less. If there’s a lot of log messages then it can slow things down.

1 Like

Actually I want to store on my database the follow logs:

  • /var/log/asterisk/messages
  • /var/log/asterisk/console
  • /var/log/asterisk/full

This logs are generated by logger.conf

This logs are very useful when you have to find problems, but is really painful when you have do debug on a text file without any delimiter to help, only using grep, pipes and awk.

I will try to do that by myself, I believe it is possible to do without too much modification using only the features offered by asterisk.

Generally one would not want anything as complex as a database between Asterisk and the disk for such logs, as one needs the logs when the system is crashing, and the more the complexity, the more likely that the logs will be compromised.

Also, with database access one may well want to write to the log in the process of trying to write to the database!

jcolp’s suggestion should work.

I send my messages to syslog and then using rsyslog I ship the logs to a third party that indexes them and runs rules on them, You would just need to have rsyslog insert the values in your own database.

All it takes in logger.conf for me to send messages is the line:

syslog.local0 => notice,warning,error

I think you would want notice,warning,error,debug,dtmf,verbose to get everything logged to syslog.

Oh, now I get it.

I will try this way, thanks.