Urchin - Record Doesn't Match Profile

It's a fix for "record doesn't match profile" error when running /scripts/runweblogs username, or /scripts/runlogsnow.

The problem I found was that in the functions:

sub urchin_getlogid
sub urchin_getprofileid

There is the following code:

$profileid =~ /recnum=(\d+)/;
$profileid = $1;

For some reason, when Urchin spat out a null result (record not found), this code would still set $profileid to a non null string. So the functions would always return a "match" even when there was none. Therefore cPanel thinks the profile and log files are already added to Urchin's DB and doesn't attempt to add it. When cPanel then tells Urchin to update the logs, Urchin has no information about the domain and therefore skips the domain.

My solution was to modify the code as follows:

sub urchin_getlogid {
my(${urchinpath},${domain}) = @_;
my $profileid = saferun("${urchinpath}/util/uconf-driver",
"action=get",
"table=logfile",
"name=\"${domain}\"");
$profileid =~ /recnum=(\d+)/;
if ($profileid ne "") {
$profileid = $1;
} else {
$profileid = -1;
}
return($profileid);
}

Basically, I changed it so it only tries to grab the first match when the $profileid is not null.

After making this change, cPanel is re-adding the domains to Urchin's profiles and their stats are being updated again.

Disclaimer: Do this at your own risk !

If this does not work, remove all log sources, then re-add all log sources, and re-run the /scripts/runweblogs.