0

I have a directory with log files. I want to process the last 13 of them (past quarter). 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.

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. 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?

Something like:

/usr/local/bin/goaccess -p /users/rich/things/goaccess.conf log1.log log2.log log3.log -o qreport.html
Rich_F
  • 1,830
  • 3
  • 24
  • 45

1 Answers1

1

MULTIPLE LOG FILES

There are several ways to parse multiple logs with GoAccess. The simplest is to pass multiple log files to the command line:

goaccess access.log access.log.1

goaccess-custom-logs

In your case, you need to process only the last three generated file so you can get the last three file using 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

Adiii
  • 54,482
  • 7
  • 145
  • 148
  • 1
    Ah I grabbed the filenames using `Ruby`, but yes, I was after the `-f` syntax which works. I don't know how I didn't find that. I checked that FAQ page. Thank you. – Rich_F Jul 22 '19 at 17:54