Try   HackMD

DeepLog: Log 資料異常值分析

tags: Research

Paper: Link

針對 log 的分析在許多資訊系統上的應用上有著很大的價值,例如異常值分析對於建立一個穩定的系統是一個很實用的分析方法。但是 log 的資料類型非常多樣,且各種數值的意義皆不相同,因此從 log 資料分析出有意義的結論是相對困難的。所以誕生出 DeepLog,針對 log 資料提出一些系統性的分析方法。

統整這篇的一些小資訊:

  1. 方法採用 Deep LSTM
  2. 優勢為可以透過用戶反饋即刻學習,不僅是可以提升模型的準確度,也對於未來新的異常狀況有辦法處理

前言

目前在 log 資料分析的挑戰如下:

  • 資料類型的不一致使得資料清洗以及建立模型相對困難
  • 當出現新的異常狀況時,單純訓練一個二分類模型(正常與否)的幫助是有限的
  • concurrency造成順序的問題使得序列的資訊部分消失
  • 過往的分析大部分只取用 log key 做為分析用的資料,這樣損失許多有用的資訊,如 metrics values

DeepLog 架構

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

DeepLog資料型態

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

DeepLog模型型態

Part I: Log Key Anomaly Detection Model

方法:透過 log key 的順序進行建模,透過key的類型

{k1,k2,...,kn} 訓練一個
n
類的多分類模型,當下一個出現的類別出現在模型預測的前
g
類(須自行定義),則視為一個 normal case。反之則為 abnormal case。

模型建構方式為採用 Deep LSTM 做為預測的模型。Loss 為 categorical cross-entropy,window 為

h.

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Part II: Parameter Value Anomaly Detection Model

方法:每種 log key 各自建立模型。假如我們拿到上方Table 1的資料時,則我們將此資料整理為

{[t2t1,0.61],[t2t1,1],...} 的數據並建模。同時考慮執行時間以及此key給出的參數數值,可以使得偵測異常值有更多的維度視角。

模型建構方式為採用 Deep LSTM,並建立一個多變量時間序列模型,損失函數為MSE。比起過往直接透過設定一個 threshold 判斷是否為異常值,這裡的方法比較特別。一開始將資料切分為 training set 以及 validation set,training data 進行模型訓練,並將 validation 輸入模型中,透過將模型的執行結果與 validation 的資料計算 MSE,並把兩者資料的差異以常態分佈建構信賴區間。如果超過信賴區間的數值,則視為異常值。

Part III: Online Update of Models

方法:直接透過真實的新數據 (有人進行 false-positive 的反饋) 進行微調 (fine-tuning) 即可,不需要重新訓練模型

DeepLog Workflow (Skip)

Results

Part I: Log Key Anomaly Detection Model

資料來自於 (1) 執行 Hadoop-based map-reduced 工作所產生的log,以及 (2) 於OpenStack上面建構VM所產生的log。資料的類型整理如下:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

執行的結果如下表:

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

可以看出在HDFS的資料集上,DeepLog 達到 top-5 accuracy 到達99.8% (top-1 accuracy為88.9%,仍是相當高)。DeepLog 在 F1-Score 的表現上也是相較於其他方法來說最好的。在 OpenStack 的資料集中,DeepLog 在 F1-Score 的表現上仍然是最好的。

並且在模型訓練的時候,調整其中的超參數。結果發現超參數對於模型的表現效果影響不大,這樣也代表著在真實的情境中,這類型的模型比較好去讓他上線,而不會因為對於超參數的選擇而有很大的表現差異。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

Part II: Parameter Value Anomaly Detection Model

在這個部分利用 OpenStack VM 的創造時間作為此實驗的目標。並在過程中製造 DoS 攻擊,造成網路的速度變慢,並觀察 VM 的創造時間,檢測模型是否可以抓到此異常狀況。

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

圖9(a)以及(b)為正常情況下的 log value,圖9©以及(d)為非正常情況下的 log key 值,其中有兩個時間為非正常的狀況。可以看出針對非正常的情況下的 log value,建構的信賴區間皆可以精準的偵測到異常狀態。

Part III: Online Update of Models

Image Not Showing Possible Reasons
  • The image file may be corrupted
  • The server hosting the image is unavailable
  • The image path is incorrect
  • The image format is not supported
Learn More →

上圖比較是否有做即時學習對於模型的表現,由圖可以清楚發現,有給予模型反饋並微調,可以讓模型的表現狀況提升許多。如果在沒有進行即時學習時,由於在 training dataset 中無法涵蓋到全部的異常狀況(甚至可以說以長期來看只包含到少部分的異常狀況),即使我們給他更多的訓練資料,也對於模型的效果提升有限。

結論

此篇研究給了我們未來在做機器上的異常值檢定,有一個明確的方向以及框架。