VIFIB DESCENTRALIZED CLOUD COMPUTING

SlapOS is a decentralized Cloud Computing technology that can automate the deployment and configuration of applications in a heterogeneous environment.

Agenda

  • Prerequisite
  • Add Logrotate entry
  • Verification

A production generate a lot logs, it is necessary to rotate said logs. Logrotate is the main tool in SlapOS.

This tutorial explains how to add a logrotate entry inside the instances of your software release for remote monitoring.

Here are the commits introducing this functionality to html5as Software release:

  1. commit diff.
  2. commit diff.

Prerequisite

Add Logrotate entry

In instance_html5as.cfg.in, add a logrotate entry for Nginx logs. Note the we use the post command as recommended in Nginx documentation to reopen log after rotation.

Log rotation can be further customized, you can check the list of parameter in instance-logrotate-base.cfg.in

# Monitor Stack also provides logrotate stack. We only need to extend
# the logrotate-entry-base defined in instance-logrotate-base.cfg.in .
# More parameters can be added following the logrotate-entry-base section
[logrotate-entry-nginx]
<= logrotate-entry-base
name = nginx
log = ${html5as:path_access_log} ${html5as:path_error_log}
post = kill -USR1 $(cat ${html5as:path_pid})

Process logrotate entry

Add the new section to the list of parts to be processed in instance_html5as.cfg.in

[buildout]
parts =
    ...
    logrotate-entry-nginx
    ...

Update md5sums

Refer How To Move to md5sum automatic update to update md5sum:

$ cd ~/srv/project/slapos/software/html5as-base
$ ../../update-hash

Validation

  1. Inspect the logs
  2. Verify the content in logrotate.d directory

Compile and Instantiate

To inspect the log of slapos node software:

$ tail -fn 100  ~/srv/runner/var/log/slapos-node-software.log

To inspect the log of slapos node instance:

$ tail -fn 100  ~/srv/runner/var/log/slapos-node-instance.log

It is normal that you have this error message:

slappart0[RootSoftwareInstance]: Promise 'monitor-http-frontend.py' failed with output: ERROR: Invalid URL '': No schema supplied. Perhaps you meant http://?

It needs time to request for a frontend.

Verify the content in logrotate.d/

Change directory:

$ cd ~/srv/runner/instance/slappart0/

List the content in logrotate.d/

$ ls etc/logrotate.d/

The content inside will be:

crond monitor-apache monitor.data monitor.service.status nginx

You are also able to browser EXPLORER to locate logrotate.d directory.