我们有两个数据库日志文件,它们正在及时更新。 已经有适当的监视脚本,在脚本运行期间,它将检查日志文件中的最后25行,并查找以下提到的错误ID。如果找到警报将被触发。
问题:当脚本在上午10点运行时,一个数据库日志文件与当前系统日期匹配
10:50:01 SRV 9: Logout usernum 1020, userid (739)
但是对于其他数据库日志文件,包含最后更新行@ 2AM,如下所示。
02:00:47 BROKER 0: Unable to open /prd/dba/db/r86d/hlpempty9.lic, errno = 13. (1295)
在修改此脚本时,需要您的人员帮助。
因此,如果此脚本根据服务器日期在@ 10 AM上运行,并且该脚本与上次行时间的数据库日志文件匹配,则只需执行该脚本。
脚本:
for DB in prdrey hlpempty9
do
. $DBA/script/mfgvars $DB
lgfile=$DBPATH/$DB.lg
if [ $? -eq 0 ]
then
echo "Error in Database : $DB \n " >> $ERRMSG
echo "===================================" >> $ERRMSG
tail -25 $lgfile | grep -E '\((1260|2527|5292|2249|541|1621|834|748|43|49|1154|1056|1055|796|5407|5410|797|4698|1280|5480|5409|6743|1049|1052|3773|3775|3784|2249|6743|9
407|831|9215|833|9450|9446|9445|6091|9318|9407|ERROR|FAILED)\)' >> $ERRMSG
echo "" >> $ERRMSG
fi
tail -25 prdrey.lg
10:38:47 SRV 4: Login usernum 1071, userid argonzalez (742)
10:39:04 SRV 9: Login usernum 1048, userid y280nxa, . (742)
10:39:29 SRV 20: Login usernum 928, userid breyes (742)
10:40:00 SRV 21: Login usernum 827, userid pgresdba (742)
10:40:00 SRV 21: Logout usernum 827, userid (739)
10:40:50 SRV 21: Login usernum 827, userid (742)
10:42:05 SRV 22: Login usernum 826, userid y280elr (742)
10:42:08 SRV 26: Login usernum 825, userid snavarrete (742)
10:42:20 SRV 8: Usernum 1050 terminated abnormally. (794)
10:42:20 SRV 8: Logout usernum 1050, userid (739)
10:42:58 SRV 20: Logout usernum 1055, userid (739)
10:43:27 SRV 16: Logout usernum 835, userid (739)
10:44:15 SRV 8: Login usernum 1055, userid y281oxc (742)
10:44:21 SRV 15: Usernum 1020 terminated abnormally. (794)
10:44:21 SRV 15: Logout usernum 1020, userid . (739)
10:44:52 SRV 31: Logout usernum 951, userid (739)
10:45:00 SRV 31: Login usernum 1050, userid pgresdba (742)
10:45:00 SRV 31: Logout usernum 1050, userid (739)
10:45:00 SRV 31: Login usernum 1050, userid pgresdba (742)
10:45:01 SRV 31: Logout usernum 1050, userid (739)
10:45:15 SRV 26: Logout usernum 870, userid (739)
10:48:59 SRV 9: Logout usernum 898, userid (739)
10:49:41 SRV 31: Login usernum 1050, userid y281oxc (742)
10:50:01 SRV 9: Login usernum 1020, userid pgresdba (742)
10:50:01 SRV 9: Logout usernum 1020, userid (739)
tail -25 hlpempty9.lg
02:00:47 BROKER 0: Delay of Before-Image Flush (-Mf): 3. (4245)
02:00:47 BROKER 0: Before-Image File I/O (-r -R): Reliable. (4247)
02:00:47 BROKER 0: Before-Image Truncate Interval (-G): 60. (4249)
02:00:47 BROKER 0: Before-Image Cluster Size: 16384. (4250)
02:00:47 BROKER 0: Before-Image Block Size: 8192. (4251)
02:00:47 BROKER 0: Number of Before-Image Buffers (-bibufs): 100. (4252)
02:00:47 BROKER 0: BI File Threshold size (-bithold): 0.0 Bytes. (9238)
02:00:47 BROKER 0: BI File Threshold Stall (-bistall): Disabled. (6552)
02:00:47 BROKER 0: After-Image Stall (-aistall): Not Enabled. (4254)
02:00:47 BROKER 0: Number of After-Image Buffers (-aibufs): 50. (4256)
02:00:47 BROKER 0: Storage object cache size (-omsize): 1024 (8527)
02:00:47 BROKER 0: Maximum Number of Clients Per Server (-Ma): 3. (4257)
02:00:47 BROKER 0: Maximum Number of Servers (-Mn): 3. (4258)
02:00:47 BROKER 0: Minimum Clients Per Server (-Mi): 5. (4259)
02:00:47 BROKER 0: Maximum Number of Users (-n): 31. (4260)
02:00:47 BROKER 0: Host Name (-H): p5lp5. (4261)
02:00:47 BROKER 0: Service Name (-S): hlpempty9. (4262)
02:00:47 BROKER 0: Network Type (-N): tcp. (4263)
02:00:47 BROKER 0: Character Set (-cpinternal): iso8859-1. (4264)
02:00:47 BROKER 0: Parameter File: /prd/dba/etc/pf/db_empty.pf. (4282)
02:00:47 BROKER 0: Minimum Port for Auto Servers (-minport): 13100. (5648)
02:00:47 BROKER 0: Maximum Port for Auto Servers (-maxport): 14999. (5649)
02:00:47 BROKER 0: This broker supports both 4GL and SQL server groups. (8865)
02:00:47 BROKER 0: Created shared memory with segment_id: 524305 (9336)
02:00:47 BROKER 0: Unable to open /prd/dba/db/r86d/hlpempty9.lic, errno = 13. (1295)
答案 0 :(得分:0)
日志只不过是我们的数据库日志文件。日志不是从任何源或目标生成的。
数据库日志文件中的时间格式已更改。
Fyi ...我们的数据库日志文件包含日期格式的历史信息。
我的问题是在一个日志文件中,它包含最新信息,但其他数据库日志文件的初始化没有太多更新。 在这种情况下,我不希望检查旧日期数据,如果仅与系统日期匹配,则不需要将其忽略并生成警报。