我對此比較陌生,但我需要編寫一個正則表達式以排除日誌中某些已知錯誤類型的幫助。正則表達式從日誌中排除某些錯誤類型
00:11:04 [0] 70-Error: Invalid index command: "/search.asp".
00:11:04 [0] 70-Error: Invalid index command: "/wingate-internal//boot.ini".
00:11:04 [0] 70-Error: Invalid index command: "/".
,並排除這樣的:
04:16:46 [8] 70-Error: Action failed - unencrypted communication is not allowed (10.40.88.11): "ACTION=GETSTATUS".
04:14:17 [7] 70-Error: Action failed - unencrypted communication is not allowed (10.40.88.11): "ACTION=GETSTATUS".
我有相同的日誌中的其他錯誤類型的都很好,報告,例如:
17:43:17.370 ExecuterW: 957:Error [2400] DB Matters - addDocToWorklist - doSqlCommand: Error executing SQL statement - CID ed83d1e0d
換句話說,我想正則表達式報告除上述兩種類型之外的所有錯誤。
我試圖創建這個正則表達式,但它似乎並沒有工作:
/(?:)(?:[^Error\:\ Action\ failed\ \-\ unencrypted\ communication\ is\ not\ allowed]*)(?:[^Error\:\ Invalid\ index\ command\:]*)/m
任何幫助將大大讚賞。
你一定要使用正則表達式呢?如果沒有什麼你想要在單獨的組中捕獲的話,如果字符串包含單詞「failed」,例如檢查代碼會更容易。 –
你使用什麼工具或編程語言? – Toto
請不要破壞你的問題。 – Magisch