Skip to content

Commit d60b3d1

Browse files
committed
fix(analytics): allow giving log files to import-apache-logs.mjs
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.
1 parent e8db5f1 commit d60b3d1

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

website/analytics/src/import-apache-logs.mjs

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,13 @@ async function mainAsync() {
3535
importedLogs += logEntries.length;
3636
}
3737

38-
for (let logFile of await globAsync(config["apache2.log_files"])) {
38+
let logFiles = process.argv.slice(2);
39+
if (logFiles.length === 0) {
40+
// If no log files were provided, use the config.
41+
logFiles = await globAsync(config["apache2.log_files"]);
42+
}
43+
44+
for (let logFile of logFiles) {
3945
await db.batchAsync(async () => {
4046
console.log(`importing from ${logFile} ...`);
4147
await parseLogFileAsync(

0 commit comments

Comments
 (0)