Method 1:
1. Click the Start menu, and then click Control Panel.
2. In the control panel, click Administrative Tools.
3. Click Event Viewer.
4. You can see the system log content information, each of which is very detailed.
Method 2:
1. Click "Run" in the start menu and enter eventvwr.
2. Click OK to open the system log immediately. If it's linux, it's easier. You only need to know the location of the log, and then you can view it through the view command. Common commands for viewing logs in Linux are: 1, "tail-100f test.log" command; 2. "head-n10test.log" command; 3. "tail-n+92" command; 4、“head-n20”; 5, "sed" command and so on.
1.linux Common Commands for Viewing Logs
Tail:
-n is the display line number; Equivalent to nl command; Examples are as follows:
Tail-100f test.log real-time monitoring 100 line log.
Tail -n 10 test.log queries the log of the last 10 line at the end of the log;
Tail -n+10 test.log queries all logs after 10;
Head:
Contrary to tail, tail is how many rows of logs are read; Examples are as follows:
Head -n 10 test.log queries the first 10 lines of logs in the log file;
Head -n-10 test.log queries all logs except the last 10 line;
Cat:
Tac is reverse vision and reverse writing of cat words; Examples are as follows:
Cat -n test.log |grep "debug" query keyword log
2. Application scenario 1: View by line number-filter out logs near keywords.
1) cat-ntest.log | grep "debug" to get the line number of the critical log.
2) cat-ntest.log | tail-n+92 | head-n20 Select the middle line where the keyword is located. Then check the log of the first 10 line and the last 10 line of this keyword:
Tail -n +92 represents the log after querying 92 lines.
Head -n 20 represents the top 20 records in the query results before checking.
3. Application Scenario 2: Query logs by date
sed-n '/20 14- 12- 17 16: 17:20/,/20 14- 12- 17 16: 17:36/p ' test . log
Special note: the above two dates must be printed in the log, otherwise it will be invalid;
First, grep' 2014-12-1716:17: 20' test.log is used to determine whether this time point exists in the log.
4. Application Scenario 3: There are too many log contents, so it is not convenient to view it when printed on the screen.
(1) Use more and fewer commands,
For example: cat -n test.log |grep "debug" |more, so it will be printed in pages. Click the spacebar to turn pages.
(2) use > Xxx.txt to save it in a file, and then you can drop down this file for analysis.
Such as: cat-ntest.log | grep "debug" > debug.txt.