- #! /Bin/sh
-
- # Show script description, different colors
-
- Echo-e"\ E[34; 1 m ###################################### ##########\ E[0 m"
-
- Echo-E"\ E[34; 1 m ### format like 'analysis _ log. Sh 2007-07-01 '###\ E[0 m"
-
- Echo-E"\ E[34; 1 m ### default parameters is today ###\ E[0 m"
-
- Echo-E"\ E[34; 1 m ###################################### ##########\ E[0 m"
- # Rsync Password
-
- Rsync_password =Ssoapi96
-
- ExportRsync_password
-
- # Obtain the number of parameters
-
- Var_parm_num =$ #
-
- # Defining temporary file names
-
- Tmp_log_file =/Tmp/API. Log
-
- Tmp_unique_file =/Tmp. Log
-
- # Check the parameter information and obtain a series of temporary log file names
-
- If[ $ Var_parm_num-EQ0 ];Then
- Today ='Date + % Y-% m-% d'
-
- Logfile =Api_log.$ Today
-
- Logfile96 =/Tmp/96_api_log.$ Today
-
- Logfile97 =/Tmp/97_api_log.$ Today
-
- Logfile98 =/Tmp/98_api_log.$ Today
-
- Logfile99 =/Tmp/99_api_log.$ Today
-
- Else
-
- Logfile =Api_log. $1
-
- Logfile96 =/Tmp/96_api_log. $1
- Logfile97 =/Tmp/97_api_log. $1
-
- Logfile98 =/Tmp/98_api_log. $1
-
- Logfile99 =/Tmp/99_api_log. $1
-
- Fi
-
- # Obtain log files (local, remote)
-
- CP/data/log/API/$ Logfile $ Logfile96
-
- Rsync-vzrtopg web @172.24. 139. 97: Apilog/$ Logfile $ Logfile97
- Rsync-vzrtopg web @172.24. 139. 98: Apilog/$ Logfile $ Logfile98
-
- Rsync-vzrtopg web @172.24. 139. 99: Apilog/$ Logfile $ Logfile99
-
- # Input the log files on different servers into one file and only go to3,4Column to remove rows containing keywords
-
- Cat$ Logfile96| Awk'{Print $3 ,"\ T"$4 }'| Grep-V"Sso_send">$ Tmp_log_file
- Cat$ Logfile97| Awk'{Print $3 ,"\ T"$4 }'| Grep-V"Sso_send">$ Tmp_log_file
-
- Cat$ Logfile98| Awk'{Print $3 ,"\ T"$4 }'| Grep-V"Sso_send">$ Tmp_log_file
-
- Cat$ Logfile99| Awk'{Print $3 ,"\ T"$4 }'| Grep-V"Sso_send">$ Tmp_log_file
-
- # Filter and sort all log files, remove duplicate records, and input them to another file.
-
- Sort-u$ Tmp_log_file>$ Tmp_unique_file
- # Output current time
-
- Echo-e"\ E[35; 1 m"'Date + % Y-% m-% d \ % H: % m: % s'"\ E[0 m"
-
- # Calculate the number of rows of certain actions, which is the number of actions
-
- Echo-e"\ E[36; 1 mlogin Nums\ E[0 m"
-
- Cat$ Tmp_log_file| Awk'{Print $1 }'| Grep"1"| WC-l
-
- Echo-E"\ E[32; 1 Muser Nums\ E[0 m"
-
- Cat$ Tmp_unique_file| Awk'{Print $1 }'| Grep"1"| WC-l
- Echo-E"\ E[33; 1mcheck_exist Nums\ E[0 m"
-
- Cat$ Tmp_log_file| Awk'{Print $1 }'| Grep"2"| WC-l
-
- # Deleting temporary log files
-
- Rm$ Tmp_log_file
-
- Rm$ Tmp_unique_file
-
- Rm$ Logfile96
-
- Rm$ Logfile97
-
- Rm$ Logfile98
-
- Rm$ Logfile99