Difference between revisions of "CLI - Log"

Line 25: Line 25:
 
</pre>
 
</pre>
  
==== Basic Command ====
+
=== Basic Command ===
 
<pre>
 
<pre>
 
LYSH@MyHostName# show log {name} [-h] [-n NUMBER] [-w] [keyword]
 
LYSH@MyHostName# show log {name} [-h] [-n NUMBER] [-w] [keyword]
Line 34: Line 34:
 
</pre>
 
</pre>
  
==== Display logs ====
+
=== Display logs ===
 
<pre>
 
<pre>
 
LYSH@MyHostName# show log apache2 // Display all apache2 logs
 
LYSH@MyHostName# show log apache2 // Display all apache2 logs
Line 40: Line 40:
 
</pre>
 
</pre>
  
==== Display last n logs ====
+
=== Display last n logs ===
 
<pre>
 
<pre>
 
LYSH@MyHostName# show log apache2 -n 10 // Display only the last 10 apache2 logs
 
LYSH@MyHostName# show log apache2 -n 10 // Display only the last 10 apache2 logs
Line 46: Line 46:
 
</pre>
 
</pre>
  
==== Display last n logs with keyword ====
+
=== Display last n logs with keyword ===
 
<pre>
 
<pre>
 
LYSH@MyHostName# show log apache2 -n 10 request // Display only the last 10 apache2 logs filtered by "request"  
 
LYSH@MyHostName# show log apache2 -n 10 request // Display only the last 10 apache2 logs filtered by "request"  
Line 52: Line 52:
 
</pre>
 
</pre>
  
==== Display logs in real-time ====
+
=== Display logs in real-time ===
 
<pre>
 
<pre>
 
LYSH@MyHostName# show log apache2 -w // Display the apache2 logs in real-time
 
LYSH@MyHostName# show log apache2 -w // Display the apache2 logs in real-time
Line 58: Line 58:
 
</pre>
 
</pre>
  
==== Display logs in real-time with keyword ====
+
=== Display logs in real-time with keyword ===
 
<pre>
 
<pre>
 
LYSH@MyHostName# show log apache2 -w request // Display the apache2 logs filtered by "request" in real-time
 
LYSH@MyHostName# show log apache2 -w request // Display the apache2 logs filtered by "request" in real-time
Line 64: Line 64:
 
</pre>
 
</pre>
  
==== keyword ====
+
=== keyword ===
 
The <code>&</code> is the Logical AND operator and the <code>|</code> is the Logical OR operator.
 
The <code>&</code> is the Logical AND operator and the <code>|</code> is the Logical OR operator.
 
<pre>
 
<pre>

Revision as of 17:46, 16 April 2021

You can see various logs using the show log command.

LYSH@MyHostName# show log -h
usage: show log [-h] {apache2,dhcpv4,dhcpv6,failover,logexp,lsyslog,mysqlerror,mysqlslow,radius,smgr,startup,syslog,update} ...

positional arguments:
    apache2                             Show apache2 log
    dhcpv4                              Show dhcpv4 log
    dhcpv6                              Show dhcpv6 log
    failover                            Show failover log
    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
    update                              Show update log

optional arguments:
  -h, --help                            show this help message and exit

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

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"