Platon Technologies
not logged in Login Registration
EnglishSlovak
open source software development celebrating 10 years of open source development! Thursday, October 15, 2026

Diff for phpWebLogAnalyzer/sql/queries/mysql.sql between version 1.3 and 1.4

version 1.3, 2002/09/05 01:26:32 version 1.4, 2002/09/11 10:58:50
Line 1 
Line 1 
 --  --
   -- phpWebLogAnalyzer - powerful weblog and analyzer
   --
   -- sql/queries/mysql.sql - MySQL statistics queries
   -- ____________________________________________________________
   --
   -- Developed by Ondrej Jombik <nepto@pobox.sk>
   -- Copyright (c) 2001-2002 Platon SDG, http://www.platon.sk/
   -- All rights reserved.
   --
   -- See README file for more information about this software.
   -- See COPYING file for license information.
   --
   -- Download the latest version from
   -- http://www.platon.sk/projects/phpWebLogAnalyzer/
   --
   
   -- NOTE: always use 'join with blanks' functionality in `screen',
   -- where copy/pasting query into your mysql console client
   
   --
 -- Detecting double records  -- Detecting double records
 -- (records, which can be created by PHP timeout exceed)  -- (records, which can be created by PHP timeout exceed)
 --  --
Line 15  http_host_id, http_referer_id, http_user
Line 35  http_host_id, http_referer_id, http_user
 server_admin_id, server_signature_id, request_uri_id, ident_username_id,  server_admin_id, server_signature_id, request_uri_id, ident_username_id,
 ident_ostype_id, session_id having count(*) > 1;  ident_ostype_id, session_id having count(*) > 1;
   
 #  --
 # weblog_accesses_raw queries  -- weblog_accesses_raw queries
 #  --
   
 # actual state for HTTP hosts  -- actual state for HTTP hosts
 select count(distinct session_id),  http_host_id from weblog_accesses_raw group by http_host_id ;  
   
 # actual state for servers  select count(distinct session_id),  http_host_id from weblog_accesses_raw group
 select count(distinct session_id),  server_name_id from weblog_accesses_raw group by server_name_id;  by http_host_id ;
   
 # actial state of scripts  -- actual state for servers
 select count(distinct session_id) as c,  script_name_id from weblog_accesses_raw group by script_name_id order by c desc;  
   
 #  select count(distinct session_id),  server_name_id from weblog_accesses_raw
 # weblog_accesses queries  group by server_name_id;
 #  
   
 # Statistika pristupov za jednotlive mesiace  -- actial state of scripts
   
 select month(datetime), count(distinct session_id) from weblog_accesses group by month(datetime);  select count(distinct session_id) as c,  script_name_id from
   weblog_accesses_raw group by script_name_id order by c desc;
   
 select concat(monthname(datetime), ' ', date_format(datetime, '%Y')) as month, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by month order by datetime;  --
   -- weblog_accesses queries
   --
   
 select date_format(datetime, '%Y-%m') as month, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by month order by month;  -- accesses statistic for particular months
   
 # statistika za jednotlive mesiace pre konkretny server  select month(datetime), count(distinct session_id) from weblog_accesses group
 select date_format(datetime, '%Y-%m-%d') as day, count(distinct session_id) as sessions, count(weblog_accesses.id) as accesses from weblog_accesses, weblog_server_names where weblog_accesses.server_name_id = weblog_server_names.id and weblog_server_names.value = 'www.prave-spektrum.sk' group by day order by sessions DESC limit 10;  by month(datetime);
   
 # welmi dobra statistika (na rozdiel od tej predchadzajucej, ktorej nerozumiem)  select concat(monthname(datetime), ' ', date_format(datetime, '%Y')) as month,
 # replace <SERVER_NAME> with your server name  count(distinct session_id) as sessions, count(id) as accesses from
   weblog_accesses group by month order by datetime;
   
 select concat(monthname(datetime), ' ', date_format(datetime, '%Y')) as month, count(distinct weblog_accesses.session_id) as sessions, count(weblog_accesses.id) as accesses, count(distinct weblog_remote_addrs.value) as IPs from weblog_accesses, weblog_remote_addrs, weblog_server_names where weblog_accesses.server_name_id = weblog_server_names.id and weblog_accesses.remote_addr_id = weblog_remote_addrs.id and weblog_server_names.value = '<SERVER_NAME>' group by month order by datetime;  select date_format(datetime, '%Y-%m') as month, count(distinct session_id) as
   sessions, count(id) as accesses from weblog_accesses group by month order by
   month;
   
 # Statistika pristupov za jednotlive roky  -- accesses statistic for paticular months for defined server
   
 select date_format(datetime, '%Y') as year, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by year order by year;  select date_format(datetime, '%Y-%m-%d') as day, count(distinct session_id) as
   sessions, count(weblog_accesses.id) as accesses from weblog_accesses,
   weblog_server_names where weblog_accesses.server_name_id =
   weblog_server_names.id and weblog_server_names.value = 'www.prave-spektrum.sk'
   group by day order by sessions DESC limit 10;
   
 # Statistika pristupov v jednotlive dni  -- the same statistic as th one above, but looks better
   -- replace <SERVER_NAME> with your server name
   
 select dayofweek(datetime), count(distinct session_id) from weblog_accesses group by dayofweek(datetime);  select concat(monthname(datetime), ' ', date_format(datetime, '%Y')) as month,
   count(distinct weblog_accesses.session_id) as sessions,
   count(weblog_accesses.id) as accesses, count(distinct
   weblog_remote_addrs.value) as IPs from weblog_accesses, weblog_remote_addrs,
   weblog_server_names where weblog_accesses.server_name_id =
   weblog_server_names.id and weblog_accesses.remote_addr_id =
   weblog_remote_addrs.id and weblog_server_names.value like '<SERVER_NAME>' group
   by month order by datetime;
   
 select dayofweek(datetime) as n, dayname(datetime) as day, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by dayname(datetime) order by n;  -- accesses statistic for particular years
   
 # Statistika v jednotlive dni mesiaca  select date_format(datetime, '%Y') as year, count(distinct session_id) as
 # Poznamka Frlo: okolo vyplaty to fici :-)  sessions, count(id) as accesses from weblog_accesses group by year order by
   year;
   
 select dayofmonth(datetime) as day, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by dayofmonth(datetime) order by sessions;  -- accesses statistic for particular days
   
 # Statistika za jednotlive dni  select dayofweek(datetime), count(distinct session_id) from weblog_accesses
 ## 10 najslabsich dni z hladiska sessions  group by dayofweek(datetime);
   
 select date_format(datetime, '%Y-%m-%d') as day, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by day order by sessions limit 10;  select dayofweek(datetime) as n, dayname(datetime) as day, count(distinct
   session_id) as sessions, count(id) as accesses from weblog_accesses group by
   dayname(datetime) order by n;
   
 ## 10 najsilnejsich dni z hladiska sessions  -- statistic for particular days in month
   -- Frlo note: around salary time are most of accesses ;-)
   
 select date_format(datetime, '%Y-%m-%d') as day, count(distinct session_id) as sessions, count(id) as accesses from weblog_accesses group by day order by sessions DESC limit 10;  select dayofmonth(datetime) as day, count(distinct session_id) as sessions,
   count(id) as accesses from weblog_accesses group by dayofmonth(datetime) order
   by sessions;
   
 #  --
 # FIXME: notes  -- Day statistics
 #  --
   
 # celkovy pocet pristupov pre jednotlive servery  -- 10 most bad days from sessions count view
 # IMPORTANT: zla query, pouziva group by podla primarneho indexu, preto funguje  
 select weblog_server_names.value as server, count(distinct weblog_accesses.session_id) as sessions, count(weblog_accesses.id) as accesses from weblog_accesses, weblog_server_names where weblog_accesses.server_name_id = weblog_server_names.id group by weblog_server_names.id;  
   
 # celkovy pocet pristupov pre jednotlive HTTP hosty  select date_format(datetime, '%Y-%m-%d') as day, count(distinct session_id) as
 select weblog_http_hosts.value as server, count(distinct weblog_accesses.session_id) as sessions, count(weblog_accesses.id) as accesses from weblog_accesses, weblog_http_hosts where weblog_accesses.http_host_id = weblog_http_hosts.id group by weblog_http_hosts.id;  sessions, count(id) as accesses from weblog_accesses group by day order by
   sessions limit 10;
   
 # SYSTEM: session list which have more than one ident  -- 10 most good days from sessions count view
 ##  replace ident_username_id with some else column to get another infos  
   
 select session_id, count(distinct ifnull(ident_username_id,0)) as cnt from weblog_accesses group by session_id having cnt > 1;  select date_format(datetime, '%Y-%m-%d') as day, count(distinct session_id) as
   sessions, count(id) as accesses from weblog_accesses group by day order by
   sessions DESC limit 10;
   
 # SYSTEM: quick session print  --
   -- FIXME: notes
   --
   
 select weblog_accesses.id, session_id, datetime, http_host_id hh, remote_addr_id as ra, http_user_agent_id ua_id, weblog_ident_usernames.value from weblog_accesses left join weblog_ident_usernames on weblog_accesses.ident_username_id = weblog_ident_usernames.id where session_id = <SESSION_ID>;  -- total accesses count for particular servers
   -- IMPORTANT: bad query; it uses wrong `group by' clausule
   --            although that it works, because it is grouped by primary index
   
   select weblog_server_names.value as server, count(distinct
   weblog_accesses.session_id) as sessions, count(weblog_accesses.id) as accesses
   from weblog_accesses, weblog_server_names where weblog_accesses.server_name_id
   = weblog_server_names.id group by weblog_server_names.id;
   
   -- total accesses count for particular HTTP hosts
   
   select weblog_http_hosts.value as server, count(distinct
   weblog_accesses.session_id) as sessions, count(weblog_accesses.id) as accesses
   from weblog_accesses, weblog_http_hosts where weblog_accesses.http_host_id =
   weblog_http_hosts.id group by weblog_http_hosts.id;
   
   -- SYSTEM: session list which have more than one ident
   --  replace ident_username_id with some else column to get another infos
   
   select session_id, count(distinct ifnull(ident_username_id,0)) as cnt from
   weblog_accesses group by session_id having cnt > 1;
   
   -- SYSTEM: quick session print
   
   select weblog_accesses.id, session_id, datetime, http_host_id hh,
   remote_addr_id as ra, http_user_agent_id ua_id, weblog_ident_usernames.value
   from weblog_accesses left join weblog_ident_usernames on
   weblog_accesses.ident_username_id = weblog_ident_usernames.id where session_id
   = <SESSION_ID>;
   
 #####  -- MiX
   -- For Radka...
   
 Najnavstevovanejsi den za mesiac.  Najnavstevovanejsi den za mesiac.
 Najnavstevovanejsia hodina za mesiac.  Najnavstevovanejsia hodina za mesiac.

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.4

Platon Group <platon@platon.org> http://platon.org/
Copyright © 2002-2006 Platon Group
Site powered by Metafox CMS
Go to Top