It was decided that we should move to using a (MySQL) database for our application logs (it is a Java app using the logback lib). I am hoping to find something like tail -f that I can use with a specific table in that database that will show me new rows as they are added (similar to how tail -f worked on log files).
|
| ||||
|
feedback
|
|
Turn on MySQL binary logging. Then you can use the | |||
|
feedback
|
|
You could do it a hacky way by using tail -f on the database file (/var/lib/mysql/database_name/table_name.MY*) and then running your query every time a line is read. | |||
|
feedback
|
|
I don't think some people understand the question (or I don't). You don't want to log the queries against the DB; rather a log from an application is going into a DB. If it were a file you could tail the log. How do you tail a table so that when a new row is added it is output? It shouldn't be to hard to write a simple loop to handle this, assuming you have a unique field that monotonically increases over time (e.g., a sequence number).
| ||||
|
feedback
|
|
I suggest adding a timestamp field to any table you want to tail. That will allow you to get the desired results very easily with a simple query. | |||
|
feedback
|
|
It appears that many of us don't quite understand your question. What do you mean by "logging database", which isn't a standard MySQL term. Use the MySQL General Query Log, which logs each statement received from a client. You can then set log_output = TABLE in your my.cnf . The file will be written to $mysql_data_directory/general_log.CSV . You can | ||||
|
feedback
|