You do not have permission to edit this page, for the following reason: The action you have requested is limited to users in the group: Users. You can view and copy the source of this page. === Log === You can see various logs that are located in each device using the <code>show log</code> command. <pre> 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 </pre> 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 [[CLI - Services(daemons) | Runtime log]] of a specific service is disabled, logs are not generated. Therefore, you should verify the status of the Runtime log by the <code>show service</code> command. If disabled, you need to [[CLI - Services(daemons) | enable]] it. {| class="wikitable" ! style='width:150px' | 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 [[ImRAD services(daemons) | dhcpv4]] service. |- | dhcpv6 || It is the logs that were generated in real-time during the runtime of the [[ImRAD services(daemons) | dhcpv6]] service. |- | failover || It is the logs that were generated in real-time during the runtime of the [[ImRAD services(daemons) | failover]] service. |- | logexp || It is the logs that were generated in real-time during the runtime of the [[ImRAD services(daemons) | 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 [[ImRAD services(daemons) | radiusd]] service. |- | smgr|| It is the logs that were generated in real-time during the runtime of the [[ImRAD services(daemons) | smgr]] service. |- | startup|| It is the logs that were generated in real-time during the runtime of the [[ImRAD services(daemons) | startup]] service. |- | syslog|| It is the Syslog. |- | ufw || It is logs of all blocked packets not matching the defined [[CLI - ufw | ufw]] policy. |- | update|| It is the System update log. |- |} ==== Displaying logs ==== <pre> LYSH@MyHostName# show log apache2 // Display all apache2 logs LYSH@MyHostName# show log radius // Display all radius logs </pre> ==== Displaying last n logs ==== <pre> 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 </pre> ==== Displaying last n logs with keyword ==== <pre> 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" </pre> ==== Displaying logs in real-time ==== <pre> 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 </pre> ==== Displaying logs in real-time with keyword ==== <pre> 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 </pre> ==== keyword with logical operator ==== The <code>&</code> is the logical "AND" operator and the <code>|</code> is the logical "OR" operator. <pre> 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" </pre> ''Note that you'd better put a keyword in quotation marks.'' ==== Displaying log files ==== To list all log files, enter the <code>show log files</code> command in the user mode. If you want to delete some log files to increase disk space, user the <code>[[CLI_-_System#storage|system storage cleanup]]</code> command. <pre> LYSH@MyHostName# show log files 0 2021-05-12 13:57 LOG/apache2/other_vhosts_access.log 0 2021-05-12 13:57 LOG/btmp 4.0K 2021-05-10 18:06 LOG/installer 4.0K 2021-05-10 18:23 LOG/private ... 289M 2021-05-12 14:40 LOG/journal/dca4ac54531c48e2ad4e199728e9e888 344M 2021-05-12 14:42 LOG </pre> ==== 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. <pre> LYSH@MyHostName# configure configure# loghost add -h usage: loghost add [-h] <A.B.C.D|WORD> [<[1-65535]>] [<[WORD]>] </pre> To send all logs to the remote server whose address is 192.168.0.100 and port is the default Syslog port(514). <pre> configure# loghost add 192.168.0.100 </pre> To send all logs to the remote server whose address is 192.168.0.100 and port is 1000. <pre> configure# loghost add 192.168.0.100 1000 </pre> 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. <pre> configure# loghost add 192.168.0.100 1000 notice </pre> To verify loghost, enter the <code>show loghost</code> in the user mode. <pre> LYSH@MyHostName# show loghost *.notice @192.168.0.100:1000 </pre> ===== rotate ===== It configures the logroate<ref>https://linux.die.net/man/8/logrotate</ref> that allows automatic rotation, compression, and removal of log files.<br> You can configure it by entering <code>log roate {size} {roate}</code> command in the configuration mode. In this command, it needs two arguments that are * size: With this, the log file is rotated when the specified size is reached. Size may be specified in bytes, kilobytes (sizeK), megabytes (sizeM), or gigabytes (sizeG) * rotate: This specifies the number of times to rotate a file before it is deleted. For example, A count of 5 means five copies are retained.<ref>http://linuxnextgen.blogspot.com/2011/04/logrotate-in-linux.html</ref> To verify current configuration, enter the <code>show system rotate</code> command in the user mode. <pre> LYSH@MyHostName# configure configure# log roate 1G 3 configure# exit LYSH@MyHostName# show system rotate log rotate : size:1G rotate:3 </pre> ===== sort ===== You can specify the order of logs display. This configuration affects when if you execute the <code>show log</code> command without -w option. you can verify current setting by executing <code>show system logsort</code>. 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. Template used on this page: Template:Note (view source) Return to CLI - Log.