kibana logTrail 查询 基于EFK默认的standard分词器
分析参考消息:2021-05-26 10:24:09.811 [com.alibaba.nacos.naming.failover] DEBUG failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00 c.a.n.c.naming.run(FailoverReactor.java:11
分析
参考消息:
2021-05-26 10:24:09.811 [com.alibaba.nacos.naming.failover] DEBUG failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00 c.a.n.c.naming.run(FailoverReactor.java:110)
分析分词效果
kibana devtool
GET _analyze
{
"analyzer": "standard",
"text": [" 2021-05-26 10:24:09.811 [com.alibaba.nacos.naming.failover] DEBUG failover switch is not found, failover00-00---000-VIPSRV_FAILOVER_SWITCH-000---00-00 c.a.n.c.naming.run(FailoverReactor.java:110)"]
}
输出
{
"tokens" : [
{
"token" : "2021",
"start_offset" : 1,
"end_offset" : 5,
"type" : "<NUM>",
"position" : 0
},
{
"token" : "05",
"start_offset" : 6,
"end_offset" : 8,
"type" : "<NUM>",
"position" : 1
},
{
"token" : "26",
"start_offset" : 9,
"end_offset" : 11,
"type" : "<NUM>",
"position" : 2
},
{
"token" : "10",
"start_offset" : 12,
"end_offset" : 14,
"type" : "<NUM>",
"position" : 3
},
{
"token" : "24",
"start_offset" : 15,
"end_offset" : 17,
"type" : "<NUM>",
"position" : 4
},
{
"token" : "09.811",
"start_offset" : 18,
"end_offset" : 24,
"type" : "<NUM>",
"position" : 5
},
{
"token" : "com.alibaba.nacos.naming.failover",
"start_offset" : 26,
"end_offset" : 59,
"type" : "<ALPHANUM>",
"position" : 6
},
{
"token" : "debug",
"start_offset" : 61,
"end_offset" : 66,
"type" : "<ALPHANUM>",
"position" : 7
},
{
"token" : "failover",
"start_offset" : 67,
"end_offset" : 75,
"type" : "<ALPHANUM>",
"position" : 8
},
{
"token" : "switch",
"start_offset" : 76,
"end_offset" : 82,
"type" : "<ALPHANUM>",
"position" : 9
},
{
"token" : "is",
"start_offset" : 83,
"end_offset" : 85,
"type" : "<ALPHANUM>",
"position" : 10
},
{
"token" : "not",
"start_offset" : 86,
"end_offset" : 89,
"type" : "<ALPHANUM>",
"position" : 11
},
{
"token" : "found",
"start_offset" : 90,
"end_offset" : 95,
"type" : "<ALPHANUM>",
"position" : 12
},
{
"token" : "failover00",
"start_offset" : 97,
"end_offset" : 107,
"type" : "<ALPHANUM>",
"position" : 13
},
{
"token" : "00",
"start_offset" : 108,
"end_offset" : 110,
"type" : "<NUM>",
"position" : 14
},
{
"token" : "000",
"start_offset" : 113,
"end_offset" : 116,
"type" : "<NUM>",
"position" : 15
},
{
"token" : "vipsrv_failover_switch",
"start_offset" : 117,
"end_offset" : 139,
"type" : "<ALPHANUM>",
"position" : 16
},
{
"token" : "000",
"start_offset" : 140,
"end_offset" : 143,
"type" : "<NUM>",
"position" : 17
},
{
"token" : "00",
"start_offset" : 146,
"end_offset" : 148,
"type" : "<NUM>",
"position" : 18
},
{
"token" : "00",
"start_offset" : 149,
"end_offset" : 151,
"type" : "<NUM>",
"position" : 19
},
{
"token" : "c.a.n.c.naming.run",
"start_offset" : 152,
"end_offset" : 170,
"type" : "<ALPHANUM>",
"position" : 20
},
{
"token" : "failoverreactor.java",
"start_offset" : 171,
"end_offset" : 191,
"type" : "<ALPHANUM>",
"position" : 21
},
{
"token" : "110",
"start_offset" : 192,
"end_offset" : 195,
"type" : "<NUM>",
"position" : 22
}
]
}
分词说明:
1. 所有英文字母均转换为小写
2. 以下特殊符号均等同空格
[
]
-
:
(
)
3. 以下符号等同英文单词,不会作分词操作
_
.
因此,本示例中如果需要搜索com.alibaba.nacos.naming.failover,则必须输入完整内容,如果输入com.alibaba.nacos.naming 则不会命中。
4. standard分词器对中文是逐个单字分词
查询
说明:查询方法基于上述分词器分词效果。
查询DEBUG级别日志
message: "debug"
注意:standard分词器默认将输入消息都转换成了小写,因此 message: "DEBUG" 与 message: "debug" 等价
查询DEBUG级别且包含failover switch is not found
message: "debug failover switch is not found"
查询naming.run方法日志
message: "c.a.n.c.naming.run"
注意:由于英文句号.不会进行分词,因此必须输入完整路经(本实例中类路径经logback做了缩写操作)
查询FailoverReactor.java文件记录的日志
message: "FailoverReactor.java"
注意:由于英文句号.不会进行分词,如果输入FailoverReactor则不会返回期望结果。
查询FailoverReactor.java第110行日志
message: "FailoverReactor.java 110"
由于分词器作用,实际效果等价于
message: "(FailoverReactor.java:110)"
message: "FailoverReactor.java:110"
查询FailoverReactor类run方法
message: "c.a.n.c.naming.run FailoverReactor.java"
注意:
1. run不能被单独检索到,必须输入c.a.n.c.naming.run
2. FailoverReactor不能被单独检索到,必须输入FailoverReactor.java
缺点:在不知道c.a.n.c.naming.run情况下,此查询难以实现,需要自行想办法找到类路径缩写。
开放原子开发者工作坊旨在鼓励更多人参与开源活动,与志同道合的开发者们相互交流开发经验、分享开发心得、获取前沿技术趋势。工作坊有多种形式的开发者活动,如meetup、训练营等,主打技术交流,干货满满,真诚地邀请各位开发者共同参与!
更多推荐
所有评论(0)