Auzre Log Analytics 文档读后感

定位:Azure 监控解决方案一部分,提供采集、分析以及行动能力(报警,触发器等)。包含在OMS套件中(Operation Management Suit),其他还包含Configuration,自动化以及Backup等服务,参见OMS

OMS 主打的是一个云上与云下混合管理的概念,在国内很多混合云的架构下喜欢将监控系统搭建在云下(On-Premise),OMS目标是通过一个统一的Repository进行Local 与 Cloud统一。

Snip20171005_67

基本概念

提供SavedSearch、Dashboard两种手段。并且可以和Power BI,Excel进行集成,LogSearch提供API支持返回结果后的二次开发。

除了以上两种方案外,本身还提供管理解决平台(提供类似模板快速部署方案)。

Snip20171005_65

整体方案比较简洁,采集数据,存储,查询+可视化。除了固定Data Source以外,还支持直接通过HTTP API进行数据写入。

关于使用可以参见Tutorial:AnalyazeVisualizeAlert

Snip20171005_66

支持数据类型:

  • 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

Sample record 4

限制:单个请求最大长度为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个服务,在中国无服务。