AnyDat...:Weblog(3pm)
π AnyDat...:Weblog(3pm) β the one where your webserver logs become a whole vibe π
okay bestie, sit down, hydrate, because this is the Perl manual page for AnyData::Format::Weblog and it is genuinely iconic. it's a plug-in, it lives in the User Contributed Perl Documentation section, and it's about to make your HTTPD logs feel like a main character. π¦
β¨ NAME β¨
AnyData::Format::Weblog β tiedhash & DBI/SQL access to HTTPD Logs. no cap, that's the whole deal: you get to poke at your web server's log files with hashes or with SQL. pick your fighter. π
πΈ SYNOPSIS πΈ
first option, the tied-hash girly route:
use AnyData;
my $weblog = adTie( 'Weblog', $filename );
while (my $hit = each %$weblog) {
print $hit->{remotehost},"\n" if $hit->{request} =~ /mypage.html/;
}
# ... other tied hash operations
literally just each over it like any other hash. the logs become little records and you go fishing. π
OR, the other option, if you're feeling database-coded today:
use DBI
my $dbh = DBI->connect('dbi:AnyData:');
$dbh->func('hits','Weblog','access_log','ad_catalog');
my $hits = $dbh->selectall_arrayref( qq{
SELECT remotehost FROM hits WHERE request LIKE '%mypage.html%'
});
# ... other DBI/SQL read operations
yes you really do just SELECT your way through an access log. it's giving database but make it a text file. π₯
π DESCRIPTION π
so what is this? it's a plug-in format parser for the AnyData and DBD::AnyData modules. π«Ά that means you can get read access to Common Log Format files β the web server log files, like NCSA or Apache β either through tied hashes or arrays, or through SQL database queries. your call, both slay.
the fieldnames come straight from the W3 definitions, which live at:
http://www.w3.org/Daemon/User/Config/Logging.html#common-logfile-format
and here they are, in order, no notes:
remotehost
usernname
authuser
date
request
status
bytes
quick heads up bestie: that second one is spelled usernname in the source, with the extra n, and i am NOT fixing it because the rule is the rule. type it exactly. β¨
plus there are two extra bonus fields that may show up if your logfiles are in extended format:
referer
client
extra fields? in my logfile? it's more likely than you think. π
and now the sad part π β this module does not currently support writing to weblog files. read-only, bestie. look, don't touch.
for the rest of the deets, go read the docs for AnyData.pm and DBD::AnyData.pm. they know things. π
π AUTHOR & COPYRIGHT π
copyright 2000, Jeff Zucker <jeff@vpservices.com> all rights reserved. respect the icon, he built this. π«‘
that's the whole page!! go parse some logs, you're doing amazing sweetie ππ¦πΈ
this lil writeup is from perl v5.36.0, dated 2023-08-06 β mwah, bye!! π
β¨
π¦ where this page comes from
- debian trixie: libanydata-perl 0.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu noble: libanydata-perl 0.12-3 Β· Artistic-1.0-Perl OR GPL-1.0-or-later
- ubuntu questing: libanydata-perl 0.12-3
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms