Skip to main content

Working with the Log File

Logging settings are normally configured during installation to use logrotate so that log files do not grow too large.

Rolling the Log File Manually

Follow these steps to manually roll the log file (example assumes /var/log/aerospike/aerospike.log is the configured log file):

  1. Move the existing log file to a new location:

    $ sudo mv /var/log/aerospike/aerospike.log [file path]
  2. Find the server's (asd) process ID:

    $ pidof asd

    In non-systemd environments it can also be found in the pidfile:

    $ cat /var/run/aerospike/asd.pid
  3. Send SIGHUP to the server (the asd process):

    $ sudo kill -s SIGHUP [asd process id]

    In the log file you will see a message saying:

    SIGHUP received, rolling log

Log messages up through the "SIGHUP received, rolling log" message will appear in the file at the new location specified by the mv command in step #1. Subsequent log messages will be written to a new /var/log/aerospike/aerospike.log file.

Determining the Log ID and the Location of the Log File

Occasionally, it might be necessary to change the log levels of different units during cluster use. Aerospike supports changing these parameters dynamically though scripted API calls using asinfo. Changing these settings does not require a server or cluster restart.

To determine where the log file is located use the command:

$ asinfo -h 127.0.0.1 -p 3000 -v "logs"

This command returns the logs that are configured and their IDs and the output looks something like this:

value is  0:/var/log/aerospike/aerospike.log

At the present, only one log is used, log 0. If using using asinfo to change logging levels, specify log 0. If using asadm, specify /var/log/aerospike/aerospike.log.

Changing the Location of the Log File

To change the default location of the log file, you must modify the configuration settings.

Changing Logging Levels

note

Tools package 6.0.x or later is required to use asadm's manage config logging command. Otherwise, use the equivalent asinfo - log-set command.

The log levels are described in the SEVERITY LEVELS section of the Log Reference.

To determine the current logging levels use the command:

$ asinfo -h 127.0.0.1 -p 3000 -v "log/0"

At the present, only one log is used, log 0. In the command above, log/0 refers to log ID 0.

This command returns the log contexts and their current levels. This example shows the default log level CRITICAL.

value is  misc:CRITICAL;alloc:CRITICAL;hash:CRITICAL;rchash:CRITICAL;shash:CRITICAL;queue:CRITICAL;msg:CRITICAL;redblack:CRITICAL;socket:CRITICAL;timer:CRITICAL;ll:CRITICAL;arenah:CRITICAL;arena:CRITICAL;config:CRITICAL;namespace:CRITICAL;as:CRITICAL;bin:CRITICAL;record:CRITICAL;proto:CRITICAL;particle:CRITICAL;demarshal:CRITICAL;write:CRITICAL;rw:CRITICAL;tsvc:CRITICAL;test:CRITICAL;nsup:CRITICAL;proxy:CRITICAL;hb:CRITICAL;fabric:CRITICAL;partition:CRITICAL;paxos:CRITICAL;migrate:CRITICAL;info:CRITICAL;info-port:CRITICAL;storage:CRITICAL;drv_mem:CRITICAL;drv_fs:CRITICAL;drv_files:CRITICAL;drv_ssd:CRITICAL;drv_kv:CRITICAL;scan:CRITICAL;index:CRITICAL;batch:CRITICAL;trial:INFO;xdr:CRITICAL;rbuffer:CRITICAL;fb_health:CRITICAL

Typically all contexts are set to INFO to minimize excess logging.

For suported severity levels, see the context configuration parameter.

To change the logging level use a command like the one below. This example demonstrates how to change the log level for the migrate context from INFO to DEBUG:

If using asadm it is as simple as typing the following command with the log file path. Keep in mind that by default asadm makes changes to every node in the cluster.

$ asadm -h 127.0.0.1 -p 3000 -e "enable; manage config logging file /var/log/aerospike/aerospike.log param migrate to debug"

or if using asinfo:

$ asinfo -h 127.0.0.1 -p 3000 -v "log-set:id=0;migrate=debug"

where the id is the log ID as described above (currently 0). This command changes the logging level until the server restarts or until you change the log level again.

This example demonstrates how to change the log level for the migrate context back to INFO:

$ asadm -h 127.0.0.1 -p 3000 -e "enable; manage config logging file /var/log/aerospike/aerospike.log param migrate to info"