• Home
  • History
  • Annotate
Name Date Size #Lines LOC

..03-May-2022-

bin/H03-May-2022-1,718743

t/H13-Sep-2012-292126

.releaseH A D13-Sep-2012427 4129

.versionH A D13-Sep-20124 21

COMMANDSH A D13-Sep-20121.9 KiB13766

MakefileH A D03-May-20221.5 KiB6943

READMEH A D13-Sep-20122 KiB8145

README

1Homepage:
2    http://www.steve.org.uk/Software/asql/
3
4Mercurial Repository:
5    http://asql.repository.steve.org.uk/
6
7
8asql
9----
10
11  ASQL is a simple tool to allow you to query Apache common logfiles
12 via SQL. (Only "Apache common" logfiles are currently supported.)
13
14  When asql starts up it creates a temporary SQLite database to hold
15 the contents of the parsed logfile(s) you might load.  This temporary
16 database may then be queried directly via SQL.
17
18  Why might you want to do this?  Well it does allow you to make certain
19 queries very easily.
20
21
22Aliases
23-------
24
25  Using the 'alias' command you may record and replay previous
26 queries by name, along with variable expansion.
27
28  For example the following query will show the number of hits
29 against your server:
30
31   SELECT COUNT(id) FROM logs;
32
33  You could save this query via this:
34
35   ALIAS hits SELECT COUNT(id) FROM logs;
36
37  Now at any future point entering 'hits' would run the query.
38
39  If you wish you can use variables in aliases such as:
40
41    ALIAS hitsagent SELECT * FROM logs where agent like '%$1%';
42
43  The text $1 will be replaced by the first argument you supply to
44 the alias when running it:
45
46   hitsagent mozilla
47   hitsagent Slurp
48
49  You can use variables from $1 to $9.
50
51  (Aliases persist between sessions via the file ~/.asql.aliases.)
52
53
54Example Queries
55---------------
56
57  The following examples give an idea of the kind of power an SQL
58 query allows you:
59
60
61  Greediest downloaders:
62
63  SELECT source,SUM(size) AS Number FROM logs GROUP BY source ORDER BY Number DESC, source
64
65  A count of each distinct referers:
66
67  SELECT referer,COUNT(referer) AS number from logs WHERE referer NOT LIKE '%steve.org.uk%' GROUP BY referer ORDER BY number DESC,referer LIMIT 0,10
68
69
70  See which Debian packages were downloaded the most:
71
72  SELECT request,COUNT(request) AS Number FROM logs WHERE request LIKE '%.deb' GROUP BY request ORDER BY Number DESC, request;
73
74
75  See who has downloaded me:
76
77   select * FROM logs WHERE request='/etch/pool/main/a/asql/asql_0.6-1_all.deb';
78
79Steve
80--
81