XPath 函数到 SQL 语句的映射

日志和跟踪分析器使用 DB2(R) 数据库来支持大型日志。在分析大型日志时,IBM 日志分析器将所有 XPath 函数转换为 SQL 语句。如果无法将 XPath 函数转换为 SQL 语句,则在分析期间将忽略 XPath 规则。

注意:必须使用症状数据库编辑器来创建 XPath 规则。

下表列示了 XPath 函数到 SQL 语句的映射。那些指明为“不受支持”的 XPath 函数无法映射到 SQL 语句。

XPath 函数 SQL 语句
Boolean 不受支持
ceiling(number) 不受支持
Concat(string1, string2, string3) 不受支持
contains()
  • 选择其消息属性包含字符串“program error”的所有事件:CommonBaseEvent[contains(@msg, 'program error')]
  • 选择其 extendedDataElement 名为“ProductName”并包含值“WebSphere”的所有事件:CommonBaseEvent[extendedDataElements[@name = 'ProductName' and contains(values,'WebSphere') and @type = 'string']]
LIKE
  • SELECT * FROM cei_t_event WHERE msg LIKE '%program error%'
  • SELECT * FROM cei_t_event WHERE global_id IN ( SELECT ext.global_id FROM cei_t_ext_element ext WHERE ext.name = 'ProductName' AND ext.level = 0 AND ext.string_value like '%WebSphere%' AND ext.data_type = 7)
Count 不受支持
false()
  • Exp = false() maps to not(exp)
  • Exp != false() maps to exp
first() 不受支持
floor(number) 不受支持
id() 不受支持
lang() 不受支持
last() 不受支持
local-name() 不受支持
name() 不受支持
namespace-uri() 不受支持
normalize-space(string) 不受支持
not(@name) NOT EXISTS
number(string) 不受支持
position() 不受支持
Round(number) 不受支持
starts_with()
  • 选择其 msg 属性以“ADMIN”开头的所有事件:CommonBaseEvent[starts-with(@msg,'ADMIN')]
LIKE
  • SELECT * FROM cei_t_event_ WHERE msg LIKE 'ADMIN%'
String() 不受支持
string-length(string) 不受支持
substring(string, num1, num2) 不受支持
substring_after(string1, string2) 不受支持
substring_before(string1, string2) 不受支持
sum() 不受支持
Translate(string1, string2, string3) 不受支持
true()
  • Exp = true() maps to exp
  • Exp != true() maps to not(exp)

相关概念
症状数据库

相关任务
导入症状数据库
导入日志文件
使用 IBM 日志分析器来分析日志记录

相关参考
症状分析结果视图