All about Information Technology!

useful

Retrieve useful information from SQL Server

Today we will see how can we retrieve various information from Microsoft SQL Server using SQL queries. Get all users: SELECT * FROM sys.server_principals; Get database size: USE master GO   EXEC sp_spaceused Get user privilleges for current database: USE master GO   SELECT SYSOBJECTS.name AS ‘objectname’, SYSUSERS.name AS ‘username’ , Action = CASE SYSPROTECTS.action [...]

>>

, , , , , , , , , ,

Retrieve useful information from MySQL

Today we will see how can we retrieve various information from mysql server using SQL queries. Get all users: SELECT * FROM mysql.USER; Get top 10 tables in size: SELECT concat(table_schema,’.',TABLE_NAME) TABLE_NAME, concat(round(data_length/(1024*1024),2),’M') data_length FROM information_schema.TABLES ORDER BY data_length DESC LIMIT 10; Get activated plugins: SELECT PLUGIN_NAME,PLUGIN_VERSION,PLUGIN_STATUS,PLUGIN_TYPE FROM information_schema.`PLUGINS` WHERE PLUGIN_STATUS=’ACTIVE’; Get user privilleges: SELECT [...]

>>

, , , , , , , , , ,

Retrieve useful information from Apache logs

Common locations where you can find Apache logs are /var/log/apache2 and /var/log/httpd/. You can extract valuable information from your apache logs. Here are some useful examples! Extract unique IP addresses: cat /var/log/apache2/access.log | awk ‘{print $1}’ | sort | uniq   Extract unique IP addresses with datetime stamp: cat /var/log/apache2/access.log | awk ‘{print $1 " [...]

>>

, , , , , , , , , , , ,