chuckhoupt / goaccess-dh

An easy to setup packaging of GoAccess for use on DreamHost
MIT License
2 stars 0 forks source link

External logs (cloudfront) #2

Open doncabreraphone opened 4 years ago

doncabreraphone commented 4 years ago

Hi again!

Two questions.

1) Can I ssh to my DH directory and see the goaccess terminal dashboard with this script?

2) Could somehow this script read external logs? I'm thinking it will be cool to use my Dreamhost installation to read my Amazon Cloudfront logs.

chuckhoupt commented 4 years ago

On # 1, Yes, the pre-built goaccess can be invoked from a terminal shell. The goaccess binary is in the bin directory and can be run as follows (of course, there are lots of command-line options to set, if desired):

 $ example.com/goaccess-dh/bin/goaccess ~/logs/example.com/https/access.log
chuckhoupt commented 4 years ago

On # 2, the goaccess-dh scripts have a little flexibility. For example, one can set a different logs directory by setting LOGS in a goaccess-dh/.env file. I use this to collect log files from several DH users/accounts (via cron, rsync, etc) into one directory, so they can be analyzed together.

More flexibility would be needed to handle CloudFront. I haven't used CloudFront, so in what form would you access the logs? I gather Cloudfront periodically places them in an S3 bucket. If so, you could periodically sync the log files to DH, and then a modified version of goaccess-dh could read them from there...

doncabreraphone commented 4 years ago

That would be a killer addition. Im working on making it happen. You are right, CloudFront send the logs to a s3 bucket.

doncabreraphone commented 4 years ago

On #1, I couldn't get it to work. When I do goaccesd --version, says goaccess dosen't exist :_(

chuckhoupt commented 4 years ago

On #1, I couldn't get it to work. When I do goaccesd --version, says goaccess dosen't exist :_(

Right, the goaccess binary isn't on your shell's PATH list (i.e. not in /usr/bin, etc), so it can't be run with just goaccess. To run it you'll need to specify a full or relative path to the goaccess-dh bin directory. For example, if you've put goaccess-dh under the example.com site in the user account, then this full path invocation should work:

/home/user/example.com/goaccess-dh/bin/goaccess --version
chuckhoupt commented 4 years ago

Another alternative to using a long path to the goaccess binary is to put the goaccess-dh/bin directory on the shell's path list. I.e. execute the following or to make it permanent, add it to .bashrc and re-login:

PATH=/home/user/example.com/goaccess-dh/bin:$PATH

Then a plain goaccess --version should work.

doncabreraphone commented 4 years ago

On # 2, the goaccess-dh scripts have a little flexibility. For example, one can set a different logs directory by setting LOGS in a goaccess-dh/.env file.

Really interested in how this would work. Could you give me an example? (keep in mind, I'm HALF tech-savvy, and I'm being quite generous with myself here).