HTTP status Code
1 header----information, the server receives the request, requires the requestor to continue to perform the operation
2 Word Header----Successful, the operation was successfully received and processed
3 Word Header----Redirect, further action required to complete the request
4 Word Header----Client error, request contains syntax error or cannot complete request
5 Word Header----Server error, the server has an error while processing the request
Apply Log parsing scripts
Cat/usr/local/nginx/logs/access.log | awk ' {print '} ' | Sort | uniq-c | Sort-rn
Sort
Options and Parameters:
-F: Ignores case differences, such as a and a are treated as encodings;
-B: Ignores the first whitespace part;
-M: Sort by month name, such as JAN, DEC and so on;
-N: Sort using "pure number" (by default it is sorted by text type);
-R: Reverse sort;
-U: Is Uniq, in the same data, only one row is represented;
-T: delimiter, the default is to use the [tab] key to separate;
K: The meaning of sorting by that interval (field)
Uniq
Options and Parameters:
-I: Ignoring the difference between uppercase and lowercase characters;
-C: Counting
-U: only display unique rows
Extracting Status Codes
Cat/usr/local/nginx/logs/access.log | awk ' {print $9} '
Extracting the information you want
Cat/usr/local/nginx/logs/access.log | Grep-ioe "http\/1\. [1|0]\ "[[: Blank:]][0-9]{3}"
grep parameters in a detailed
-I ignores case
-O to output only the portion of the file that matches
-E for precise
Special symbols represent meaning
[: Alnum:] representing English-size letters and numbers, i.e. 0-9, A-Z, A-Z
[: Alpha:] on behalf of any English-size writing section, i.e. A-Z, A-Z
[: Blank:] represents both the blank key and the [Tab] key
[: Cntrl:] represents the control keys above the keyboard, which includes CR, LF, Tab, Del. Wait a minute
[:d Igit:] stands for numbers, i.e. 0-9
[: Graph:] All other keys except blank bytes (blank key and [Tab] key)
[: Lower:] represents the lowercase section, i.e. A-Z
[:p rint:] represents any byte that can be printed out
[:p UNCT:] represents punctuation (punctuation symbol), i.e.: "'?!; : # $...
[: Upper:] represents uppercase bytes, i.e. A-Z
[: space:] Any bytes that generate whitespace, including blank keys, [Tab], CR, etc.
[: Xdigit:] Represents a numeric type of 16 digits, so includes: 0-9, A-f, a-f number and byte
Shell parsing HTTP logs