Skip to content
标签
欢迎扫码关注公众号

Kibana Timelion 多个分组 + 自定义 label

假设有如下查询:

javascript
.es(
    q="com.aliyun.datahub.client.exception.DatahubClientException",
    index=logstash-*,
    split=appName:10,
    split=serverName:10,
    timefield=timestamp
)
.bars()

没有设置 .label() 时其标签名如下:

q:com.aliyun.datahub.client.exception.DatahubClientException > appName:A-Application > serverName:10.0.15.120 > count

此时设置 .label() 方法的 regex 参数来匹配默认的标签名。

由于使用了两个分组,使用 .* appName:(.*) > serverName:(.*) >.* 来分别匹配对应的分组值,再将 label 设置为 $1 > $2 ,最终将显示为 A-Application > 10.0.15.120 的形式。

javascript
.es(
    q="com.aliyun.datahub.client.exception.DatahubClientException",
    index=logstash-*,
    split=appName:10,
    split=serverName:10,
    timefield=timestamp
)
.bars()
.label(
    regex='.* appName:(.*) > serverName:(.*) >.*',
    label='$1 > $2'
)

详细说明一下 .* appName:(.*) > serverName:(.*) >.* 正则表达式。

  • .* 表示匹配任意字符任意次;
    开头和结尾各有一个。
  • (.*) 括号括起来表示其是一个分组,之后 label 中可以使用 $n (n 从 1 开始)的形式引用;
    这里由于有两个 split 所以使用了两个分组。
  • 其它的如空格、空格 + > + 空格、空格 + > 都是固定的字符,表示匹配相同的字符。

参考:Timelion split multiple times

Page Layout Max Width

Adjust the exact value of the page width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the page layout
A ranged slider for user to choose and customize their desired width of the maximum width of the page layout can go.

Content Layout Max Width

Adjust the exact value of the document content width of VitePress layout to adapt to different reading needs and screens.

Adjust the maximum width of the content layout
A ranged slider for user to choose and customize their desired width of the maximum width of the content layout can go.