Unifix knowledge database - The original one

Dashboard - News - Search - List - About - Admin


sql til mod_sql_log

Author:black - Tue May 18 17:48:53 2004

smid mod_sql_log ind:
http://www.outoforder.cc/projects/apache/mod_log_sql/'

guide:
http://www.linux-mag.com/2002-10/lamp_01.html

sæt flg i mod_sql_log.conf:

LogSQLLoginInfo             localhost apache KoDe
LogSQLSocketFile            /var/run/mysql/mysql.sock
LogSQLDatabase              apache
LogSQLCreateTables          On
LogSQLMassVirtualHosting    On
LogSQLPreserveFile          apache_queries.sql

nice queries:

# sidste 30 besøg med lidt relevant data
SELECT remote_host, request_uri, bytes_sent, status, FROM_UNIXTIME(time_stamp) AS dato from access_blackthorne_dk ORDER BY dato DESC LIMIT 30;

# besøg fra forskellige IP adresser
SELECT COUNT(*) AS visits, SUM(bytes_sent) AS bytes, remote_host FROM access_blackthorne_dk GROUP BY remote_host;

# besøg i alt og bytes i alt
SELECT COUNT(*) AS visits, SUM(bytes_sent) AS bytes FROM access_blackthorne_dk;

# besøg den sidste time
SELECT COUNT(*) FROM access_blackthorne_dk WHERE time_stamp BETWEEN UNIX_TIMESTAMP(NOW()) - 86400 AND UNIX_TIMESTAMP(NOW());

# besøg denne måned
SELECT COUNT(*) FROM access_blackthorne_dk WHERE MONTH(FROM_UNIXTIME(time_stamp)) = MONTH(NOW());
Copyright(c) Unifix.org 2002-2011


Dashboard - News - Search - List - About - Admin
 
Powered by Mikjaer Consulting Solutions - Hosted by Specialhosting.dk