简体   繁体   English

Goaccess处理多个日志

[英]Goaccess Process Multiple Logs

I have a directory with log files. 我有一个包含日志文件的目录。 I want to process the last 13 of them (past quarter). 我要处理其中的最后13个(过去的季度)。 I can't use a wildcard using Goaccess because I don't want to include all of them, just the last 13 generated weeks' worth. 我无法在Goaccess使用通配符,因为我不想包括所有的通配符,而只希望生成最后13周的值。

I have an array of the filenames of those last 13 files, but I don't know the syntax for the Goaccess command to include those files. 我有最后13个文件的文件名数组,但我不知道Goaccess命令包含这些文件的语法。 I can't find any reference as to how to do this, as all notes I've seen refer to using a wildcard. 我找不到有关如何执行此操作的任何参考,因为我看到的所有注释都涉及使用通配符。 I don't want to start copying and moving files around. 我不想开始复制和移动文件。 There should be a way of doing this in the command line with multiple filenames which I can generate just fine. 在命令行中应该有一种使用多个文件名来执行此操作的方法,我可以生成很多文件名。

How can I use a multiple logname input syntax in Goaccess ? 如何在Goaccess使用多个Goaccess输入语法?

Something like: 就像是:

/usr/local/bin/goaccess -p /users/rich/things/goaccess.conf log1.log log2.log log3.log -o qreport.html

MULTIPLE LOG FILES 多个日志文件

There are several ways to parse multiple logs with GoAccess. 有几种使用GoAccess解析多个日志的方法。 The simplest is to pass multiple log files to the command line: 最简单的方法是将多个日志文件传递到命令行:

goaccess access.log access.log.1

goaccess-custom-logs goaccess-定制日志

In your case, you need to process only the last three generated file so you can get the last three file using ls . 在您的情况下,您只需要处理最后生成的三个文件,因此可以使用ls获取最后三个文件。 The final command will become 最后的命令将变为

/usr/local/bin/goaccess -p /users/rich/things/goaccess.conf  $(ls -t log* | head -3 | tr '\r\n' ' ') -o qreport.html

This will process the last three files that is started with log 这将处理以log开头的最后三个文件

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM