viewing drupal logs from CLI

From thelinuxwiki
Jump to: navigation, search

==problem== viewing drupal logs without using the web interface or drush

drupal logs are kept in the backend database,so we can pull them from there.

solution

(optional) create a database user just for viewing

example from mysql shell

mysql> GRANT SELECT ON 'my_database_name'.* TO 'my_username'@'localhost' IDENTIFIED BY 'mypassword';

view watchlog logs

mysql -h localhost -u my_username my_database_name -e "select hostname from watchdog " --password=my_password