asql-1.6/ 0000755 0001750 0001750 00000000000 11452433263 010517 5 ustar skx skx asql-1.6/COMMANDS 0000644 0001750 0001750 00000003712 11452433263 011646 0 ustar skx skx alias
-----
Define a persistent alias, or list those aliases currently defined.
If no arguments are given all current aliases, as loaded from the
alias file are displayed.
Aliases persist by default and may be created by running something
like this:
alias agents SELECT distinct(agent) FROM logs
Once this has been entered the new command 'agents' will run the given
query.
To remove the alias run:
alias agents
alter
-----
Run an ALTER query against the database.
create
------
Run a CREATE query against the database.
delete
------
Run a DELETE query against the database.
drop
----
Run a DROP query against the database.
exit
----
Exit the shell.
help
----
If a command is given then show help about that command.
If no command is specified give an overview of all available commands.
insert
------
Run an INSERT query against the database.
load
----
Load an Apache logfile into the currently open table.
You may either specify a single file, or a glob pattern.
Files with a .gz, or .bz2 suffix will be automtically decompressed and loaded.
To save time parsing the logfile(s) specified you may save the database once
it has been populated via 'save' and 'restore'.
quit
----
Exit this shell.
restore
-------
Load a SQLite database which was previously saved via 'save'.
This immediately makes any previously saved records available, without the need to reload the logile(s).
save
----
Save the temporary SQLite database which was create at startup time.
This means you won't need to wait for the relatively slow logfile parsing
at startup. Use the 'restore' command to reload this database in the future.
select
------
Run a SELECT query against the database.
Example queries
SELECT distinct(source) FROM logs
SELECT referer,COUNT(referer) AS number from logs GROUP BY referer ORDER BY number DESC,referer
etc.
show
----
Show the structure of the database.
update
------
Run an UPDATE query against the database.
asql-1.6/README 0000644 0001750 0001750 00000003001 11452433263 011371 0 ustar skx skx
asql
----
ASQL is a simple tool to allow you to query Apache common logfiles
via SQL. When it starts up it creates a temporary SQLite database
which later you may load Apache logfiles to.
Once you've loaded files you may then query against the temporary
database.
Why might you want to do this? Well it does allow you to make certain
queries very easily.
Aliases
-------
Using the 'alias' command you may record and replay previous
queries by name.
For example the following query will show the number of hits
against your server:
SELECT COUNT(id) FROM logs;
You could save this query via this:
ALIAS hits SELECT COUNT(id) FROM logs;
Now at any future point entering 'hits' would run the query.
(Aliases persist between sessions via the file ~/.asql.aliases.)
Example Queries
---------------
The following examples give an idea of the kind of power an SQL
query allows you:
Greediest downloaders:
SELECT source,SUM(size) AS Number FROM logs GROUP BY source ORDER BY Number DESC, source
A count of each distinct referers:
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
See which Debian packages were downloaded the most:
SELECT request,COUNT(request) AS Number FROM logs WHERE request LIKE '%.deb' GROUP BY request ORDER BY Number DESC, request;
See who has downloaded me:
select * FROM logs WHERE request='/etch/pool/main/a/asql/asql_0.6-1_all.deb';
Steve
--
asql-1.6/.version 0000644 0001750 0001750 00000000004 11452433263 012177 0 ustar skx skx 1.6
asql-1.6/.release 0000644 0001750 0001750 00000000653 11452433263 012144 0 ustar skx skx #
# Configuration file for 'release'.
#
# http://release.repository.steve.org.uk/
#
# Steve
# --
#
#
# Command to run
#
preupload="make release"
#
#
# Pattern for our release tarball.
#
pattern=asql-[0-9].[0-9].tar.gz*
#
# Version number
#
version=.version
#
# Pattern for our GPG-signature.
#
signature=asql-[0-9].[0-9].tar.gz.asc
#
# Upload location.
#
upload=s-steve@www.steve.org.uk:htdocs/Software/asql
asql-1.6/bin/ 0000755 0001750 0001750 00000000000 11452433263 011267 5 ustar skx skx asql-1.6/bin/make-cmds 0000755 0001750 0001750 00000002421 11452433263 013055 0 ustar skx skx #!/usr/bin/perl
#
# This is a quick hack which will read the specified asql file and
# output a complete list of all commands to STDOUT.
#
# It is designed to create the documentation for the shell automatically.
#
# Steve
# --
#
#
# We are called with a single argument - the path to 'asql'.
#
my $file = shift;
die "No file" unless ( defined($file) );
die "File not found - $file" unless ( -e $file );
#
# Read the text
#
my $text = '';
my $in = 0;
open( INPUT, "<", $file ) or
die "Failed to open $file -$!";
foreach my $line ()
{
next if ( !$line );
chomp($line);
next if ( !$line );
if ($in)
{
if ( $line =~ /END_COMMAND_TABLE/ )
{
$in = 0;
}
else
{
$text .= $line . "\n";
}
}
else
{
if ( $line =~ /START_COMMAND_TABLE/ )
{
$in = 1;
}
}
}
close(INPUT);
#
# Hack: declare our own dispatch table and make the read text
# refer to it.
#
my %dispatch;
$text =~ s/my \%dispatch/\%dispatch/g;
eval $text;
#
# Now output the text.
#
foreach my $key ( sort keys %dispatch )
{
my $cmd = $key;
my $under = "-" x length($key);
my $text = $dispatch{ $key }->{ 'help' };
print <