Skip to content

Commit

Permalink
fix(analytics): allow giving log files to import-apache-logs.mjs
Browse files Browse the repository at this point in the history
The documentation for import-apache-logs.mjs
(website/analytics/README.md) suggests invoking import-apache-logs.mjs
with the log file paths as command-line parameters. This does not work
because import-apache-logs.mjs only looks at apache2.log_files in
config.json.

Make the documented command work by importing log files given on the
command line.
  • Loading branch information
strager committed Nov 26, 2023
1 parent e8db5f1 commit d60b3d1
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion website/analytics/src/import-apache-logs.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,13 @@ async function mainAsync() {
importedLogs += logEntries.length;
}

for (let logFile of await globAsync(config["apache2.log_files"])) {
let logFiles = process.argv.slice(2);
if (logFiles.length === 0) {
// If no log files were provided, use the config.
logFiles = await globAsync(config["apache2.log_files"]);
}

for (let logFile of logFiles) {
await db.batchAsync(async () => {
console.log(`importing from ${logFile} ...`);
await parseLogFileAsync(
Expand Down

0 comments on commit d60b3d1

Please sign in to comment.