Difference between revisions of "CLI - Log"

Line 11: Line 11:
 
</pre>
 
</pre>
 
If you want to see logs for a specific service, you ensure that the [[CLI - Services(daemons) | Runtime Log]] is enabled or not.
 
If you want to see logs for a specific service, you ensure that the [[CLI - Services(daemons) | Runtime Log]] is enabled or not.
 +
The below table shows you all kinds of logs.
 +
{| class="wikitable"
 +
! style='width:150px' | log name !! log description
 +
|-
 +
| apache2 || apache2 access log
 +
|-
 +
| dhcpv4 || dhcpv4 service Runtime log
 +
|-
 +
| dhcpv6 || dhcpv6 service Runtime log
 +
|-
 +
| failover || failover service Runtime log
 +
|-
 +
| logexp || logexp service Runtime log
 +
|-
 +
| failover || failover service Runtime log
 +
|-
 +
|}
 +
 +
    apache2                            show apache2 log
 +
    dhcpv4                              show dhcpv4 log
 +
    dhcpv6                              show dhcpv6 log
 +
    failover                            show failover log
 +
    files                              show log files
 +
    logexp                              show logexp log
 +
    lsyslog                            show product syslog log
 +
    mysqlerror                          show mysql error log
 +
    mysqlslow                          show mysql slow query log
 +
    radius                              show radius log
 +
    smgr                                show smgr log
 +
    startup                            show startup log
 +
    syslog                              show syslog log
 +
    ufw                                show ufw log
 +
    update                              show update log
  
 
=== Display logs ===
 
=== Display logs ===

Revision as of 11:37, 29 April 2021

You can see various logs using the show log command.

Basic 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

If you want to see logs for a specific service, you ensure that the Runtime Log is enabled or not. The below table shows you all kinds of logs.

log name log description
apache2 apache2 access log
dhcpv4 dhcpv4 service Runtime log
dhcpv6 dhcpv6 service Runtime log
failover failover service Runtime log
logexp logexp service Runtime log
failover failover service Runtime log
   apache2                             show apache2 log
   dhcpv4                              show dhcpv4 log
   dhcpv6                              show dhcpv6 log
   failover                            show failover log
   files                               show log files
   logexp                              show logexp log
   lsyslog                             show product syslog log
   mysqlerror                          show mysql error log
   mysqlslow                           show mysql slow query log
   radius                              show radius log
   smgr                                show smgr log
   startup                             show startup log
   syslog                              show syslog log
   ufw                                 show ufw log
   update                              show update log

Display logs

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

Display 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

Display 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" 

Display 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

Display 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

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"