Currently Viewing Posts Tagged “Digital Ocean”

Use GoAccess to Generate Report with Multiple Nginx Log Files

I have a VPS with Nginx as a web server and also a lot of web sites on it. It is on Digital Ocean.

Here is the VPS basic information.

  • SFO2
  • 1GB Nanode
  • Ubuntu Linux 18.04.2
  • Intel(R) Xeon(R) CPU E5-2650 v4 @ 2.20GHz, 1 cores
  • Nginx 1.15.9

All sites use one access.log file. The following code is in the http block of /etc/nginx/nginx.conf file.

log_format main '$remote_addr - $remote_user [$time_local] "$request" '
'$status $body_bytes_sent "$http_referer" '
'"$http_user_agent" "$http_x_forwarded_for"';

access_log /var/log/nginx/access.log main;

All access logs look like below:

Now it is time to show you how to use GoAccess to Generate Report with Multiple Nginx Log files.

Install GoAccess

sudo install goaccess

 

Modify the Config file of GoAccess

GoAccess config file is located at /etc/

sudo nano /etc/goaccess.conf

Add the following code or modify the code inside of the goaccess.conf.

time-format %H:%M:%S

date-format %d/%b/%Y

log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"

Run GoAccess to generate the report

I would like to get a static report.

sudo goaccess /var/log/nginx/access.log -o /home/davidyin/mywebsite.com/report.html --log-format=COMBINED

The report looks like below:

Due to the log is not just one file. The log files are generated by date and also compressed.

Two log files are not compressed.

  • access.log
  • access.log.1

The older log files are compressed.

  • access.log.2.gz
  • access.log.3.gz
  • access.log.4.gz
  • access.log.5.gz

I want to generate all the access log files. So the command is changed to the way which can phrase multiple log files.

zcat /var/log/nginx/access.log.*.gz | goaccess /var/log/nginx/access.log /var/log/nginx/access.log.1 - -o /home/davidyin/mywebsite.com/report.html --log-format=COMBINED

The sample command above using mywebsite.com. Please replace it with your own sites.

At the last, I add this command into Cron jobs. Schedule it every hour.

Move to Linode Server

When you saw this post, it means the blog is moved to a new server at Linode.

New server is a little bit better than the old one at DigitalOcean.

Here is how old server looks like:

  • Operating system     Ubuntu Linux 14.04.4
  • Kernel and CPU     Linux 3.13.0-88-generic on x86_64
  • Processor information     Intel(R) Xeon(R) CPU E5-2630L v2 @ 2.40GHz, 1 cores
  • 1 GB RAM
  • 20 GB Storage SSD

digitalocean-spotlight

New server at Linode has following specs:

  • Operating system     Ubuntu Linux 16.04
  • Kernel and CPU     Linux 4.6.3-x86_64-linode70 on x86_64
  • Processor information     Intel(R) Xeon(R) CPU E5-2680 v3 @ 2.50GHz, 1 cores
  • 2 GB RAM
  • 24GB Storage SSD

linode-brentwood Continue reading “Move to Linode Server”

Bench test result of DigitalOcean Singapore Datacenter (SGP1)

DigitalOcean announced Singapore Datacenter (SGP1)  vi. It is a new node physically in Asia. A lot of Chinese webmasters rushed to it.

I created a new droplet at SGP1. Just minimum size droplet.

  • 512MB/1CPU
  • 20GB SSD Disk
  • 1TB Transfer
  • Singapore Region
  • CentOS 6.5 x32
  • $5/month

sgp1-droplet

Go to ServerBear site and get the testing command and paste into the terminal window. The command will update the system and install the necessary packages, then run the bench tasks.

The result as below: Continue reading “Bench test result of DigitalOcean Singapore Datacenter (SGP1)”

  • Archives