I need help with an existing variable of drupal How I can use in my code the value where exists on configuration->Logging and errors->Database log messages to keep?? Could anyone help me to find out how I can use this number that the user will select? What is the name of these variable??
The "Database log messages to keep" tells the site how many entries to store in "Recent Log Messages" (/admin/reports/dblog). It stores a record of watchdog events and php warning/errors, etc. 

The limit is stored in the variable table, under the variable name of dblog_row_limit.