Fix handling missing log files

This commit is contained in:
Witek Bedyk 2021-11-18 13:14:56 +01:00
parent bab90ef34a
commit c8d2cf77ce
2 changed files with 12 additions and 10 deletions

View File

@ -22,12 +22,14 @@ $source_map = [
'2014-04-14' => sprintf(LANGLEY, 2) . '/' . VHOST,
'2017-12-04' => sprintf(LANGLEY, 3) . '/' . VHOST,
// 2017-12-05 has bad permissions on langley and is still on origin.
'2021-09-05' => false,
$begin->format('Y-m-d') => PONTIFEX . '/' . VHOST,
'filename' => FILENAME,
],
'ipv6' => [
'2012-12-31' => false,
'2017-12-04' => sprintf(LANGLEY, 3) . '/' . IPV6_PREFIX . VHOST,
'2021-09-05' => false,
$begin->format('Y-m-d') => PONTIFEX . '/' . IPV6_PREFIX . VHOST,
'filename' => IPV6_PREFIX . FILENAME,
],
@ -408,8 +410,6 @@ function write($points)
if (!$database) {
$database = InfluxDB\Client::fromDSN('influxdb://0.0.0.0:8086/osrt_access');
$database->drop();
$database->create();
}
if (!$database->writePoints($points, Database::PRECISION_SECONDS)) die('failed to write points');

View File

@ -61,11 +61,13 @@ error_log('found ' . number_format($total) . ' requests across ' .
ksort($total_product);
ksort($unique_product);
echo json_encode([
'total' => $total,
'total_product' => $total_product,
'unique_product' => $unique_product,
'total_image_product' => $total_image_product,
'total_invalid' => $total_invalid,
'bytes' => $position,
]) . "\n"; // JSON_PRETTY_PRINT for debugging.
if ($position) {
echo json_encode([
'total' => $total,
'total_product' => $total_product,
'unique_product' => $unique_product,
'total_image_product' => $total_image_product,
'total_invalid' => $total_invalid,
'bytes' => $position,
]) . "\n"; // JSON_PRETTY_PRINT for debugging.
}