Log

You can see various logs that are located in each device using the show log command.

LYSH@MyHostName# show log {name} [-h] [-n NUMBER] [-w] [keyword]
optional arguments:
  -h, --help                      show this help message and exit
  -n [NUMBER], --number [NUMBER]  enter 0 to show all logs, and enter a value greater than 0 to show as much as the value entered
  -w, --watch                     show the log or setup status in real time

The below table shows you all kinds of logs. Some logs are generated in real-time during the runtime of a specific service, which is called "Runtime log".

If the Runtime log of a specific service is disabled, logs are not generated. Therefore, you should verify the status of the Runtime log by the show service command. If disabled, you need to enable it.

log name log description
apache2 It is the apache2 access log.
dhcpv4 It is the logs that were generated in real-time during the runtime of the dhcpv4 service.
dhcpv6 It is the logs that were generated in real-time during the runtime of the dhcpv6 service.
failover It is the logs that were generated in real-time during the runtime of the failover service.
logexp It is the logs that were generated in real-time during the runtime of the logexp service.
lsyslog It is the Syslog generated from the imRAD services.
mysqlerror It is the Syslog generated from the imRAD services.
radius It is the logs that were generated in real-time during the runtime of the radiusd service.
smgr It is the logs that were generated in real-time during the runtime of the smgr service.
startup It is the logs that were generated in real-time during the runtime of the startup service.
syslog It is the Syslog.
ufw It is logs of all blocked packets not matching the defined ufw policy.
update It is the System update log.

Displaying logs

LYSH@MyHostName# show log apache2		// Display all apache2 logs
LYSH@MyHostName# show log radius		// Display all radius logs

Displaying last n logs

LYSH@MyHostName# show log apache2 -n 10		// Display only the last 10 apache2 logs
LYSH@MyHostName# show log radius -n 10		// Display only the last 10 radius logs

Displaying last n logs with keyword

LYSH@MyHostName# show log apache2 -n 10	request	// Display only the last 10 apache2 logs filtered by "request" 
LYSH@MyHostName# show log radius -n 10	accept	// Display only the last 10 radius logs filtered by "request" 

Displaying logs in real-time

LYSH@MyHostName# show log apache2 -w		// Display the apache2 logs in real-time
LYSH@MyHostName# show log radius -w		// Display the radius logs in real-time

Displaying logs in real-time with keyword

LYSH@MyHostName# show log apache2 -w request	// Display the apache2 logs filtered by "request" in real-time
LYSH@MyHostName# show log radius -w accept	// Display the radius logs filtered by "accept" in real-time

keyword with logical operator

The & is the logical "AND" operator and the | is the logical "OR" operator.

LYSH@MyHostName# show log "request&reply"		// Display the apache2 logs having both "request" and "reply"
LYSH@MyHostName# show log "request|reply"		// Display the apache2 logs having either "request" or "reply"

Note that you'd better put a keyword in quotation marks.


Configuration

loghost

It is the configuration for Syslog to log remotely. We term such remote log server "loghost".If there is the same "loghost", it overwrites to the new one.

LYSH@MyHostName# configure
configure# loghost add -h
usage: loghost add [-h] <A.B.C.D|WORD> [<[1-65535]>] [<[WORD]>]

To send all logs to the remote server whose address is 192.168.0.100 and port is the default Syslog port(514).

configure# loghost add 192.168.0.100

To send all logs to the remote server whose address is 192.168.0.100 and port is 1000.

configure# loghost add 192.168.0.100 1000	

To send logs whose level is greater than or equal to "notice" to the remote server whose address is 192.168.0.100 and port is 1000.

configure# loghost add 192.168.0.100 1000 notice

To verify loghost, enter the show loghost in the user mode.

LYSH@MyHostName# show loghost
*.notice @192.168.0.100:1000
rotate

It configures the logroate<ref>https://linux.die.net/man/8/logrotate</re> that allows automatic rotation, compression, and removal of log files.

sort

You can specify the order of logs display. This configuration affects when if you execute the show log command without -w option. you can verify current setting by executing show system logsort. If the sort is "desc," it shows logs in descending order. If the sort is "asc", it shows logs in ascending order.

LYSH@MyHostName# show system logsort
logsort                       : desc		// logs are shown in descending order.

You can change the order in the configuration mode.

LYSH@MyHostName# configure
configure# log sort asc
configure# exit
LYSH@MyHostName# show system logsort
logsort                       : asc		// logs are shown in descending order.