423
技術社區[雲棲]
Azure Log Analytics產品API文檔讀後感
定位:Azure 監控解決方案一部分,提供采集、分析以及行動能力(報警,觸發器等)。包含在OMS套件中(Operation Management Suit),其他還包含Configuration,自動化以及Backup等服務,參見OMS。
OMS 主打的是一個雲上與雲下混合管理的概念,在國內很多混合雲的架構下喜歡將監控係統搭建在雲下(On-Premise),OMS目標是通過一個統一的Repository進行Local 與 Cloud統一。
基本概念
提供SavedSearch、Dashboard兩種手段。並且可以和Power BI,Excel進行集成,LogSearch提供API支持返回結果後的二次開發。
除了以上兩種方案外,本身還提供管理解決平台(提供類似模板快速部署方案)。
整體方案比較簡潔,采集數據,存儲,查詢+可視化。除了固定Data Source以外,還支持直接通過HTTP API進行數據寫入。
關於使用可以參見Tutorial:Analyaze, Visualize, Alert
支持數據類型:
- Windows Event Logs
- Windows PerfCounter
- Linux Perf counter
- IIS Logs
- Custom Fields
- Clustom Logs
- Syslog
參見:https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-data-sources
API 與數據模型
Record:為KeyValue結構
{ "property1": "value1", " property 2": "value2" " property 3": "value3", " property 4": "value4" }
Batch寫入,可以由多個Records組成,但Key數目必須一致。
在寫入時的HTTP請求Header中有2個簽名外的Header字段:
- time-generated-field : The name of a field in the data that contains the timestamp of the data item. If you specify a field then its contents are used for TimeGenerated. If this field isn’t specified, the default for TimeGenerated is the time that the message is ingested. The contents of the message field should follow the ISO 8601 format YYYY-MM-DDThh:mm:ssZ.
- Log-Type:Specify the record type of the data that is being submitted. Currently, the log type supports only alpha characters. It does not support numerics or special characters.
第一個用指定日誌中哪個字段為時間字段。Log-Type用以指定日誌中每個字段的類型。例如在頭中number_s 代表key為number字段類型是String
限製:單個請求最大長度為30MB;每個Value最大為為32KB(超過會被截斷)
Log Search能力分析
完整語法可以參見 https://docs.microsoft.com/en-us/azure/log-analytics/log-analytics-log-searches 。
SPL方式的語法,但功能比較簡單與 Splunk 差距較大。在查詢中帶了一個 Regex方式的查詢,算是特點。
費用
包含FreeTier費用:
- 一天500MB,數據保留7天,超過500MB時服務到24點前無法使用
收費部分:
- 數據保留一個月,2.3$/GB = 15 RMB RMB,無寫入費用
- 超過一個月後存儲費用為0.1$/GB*Month = 0.66 RMB,存儲費用比較貴
在日本東/西有2個Region,在中國無服務。
最後更新:2017-10-10 00:03:08