global.json•7.02 kB
{
"type": "page",
"title": "全局日志查询",
"body": [
{
"type": "form",
"title": "日志搜索",
"mode": "inline",
"target": "globalLogTable",
"submitText": "搜索",
"body": [
{
"type": "select",
"name": "cluster",
"label": "集群",
"placeholder": "选择集群",
"source": "get:/params/cluster/option_list",
"searchable": true,
"clearable": true,
"required": false,
"value": "${''|selectedCluster}",
"onEvent": {
"change": {
"actions": [
{
"actionType": "custom",
"script": "window.setCurrentClusterId(event.data.value || '')"
},
{
"actionType": "custom",
"script": "/* 重置依赖字段 */ doAction({actionType:'clear',componentId:'namespace'}); doAction({actionType:'clear',componentId:'node_name'}); doAction({actionType:'clear',componentId:'pod_name'});"
}
]
}
}
},
{
"type": "select",
"name": "namespace",
"id": "namespace",
"label": "命名空间",
"searchable": true,
"clearable": true,
"source": {
"method": "get",
"url": "/k8s/ns/option_list",
"data": {
"__cluster": "${ ''|selectedCluster}"
}
},
"disabledOn": "!this.cluster && !''|selectedCluster"
},
{
"type": "select",
"name": "node_name",
"id": "node_name",
"label": "节点名",
"searchable": true,
"clearable": true,
"source": {
"method": "get",
"url": "/k8s/node/name/option_list",
"data": {
"__cluster": "${ ''|selectedCluster}"
}
},
"disabledOn": "!this.cluster && !(''|selectedCluster)"
},
{
"type": "select",
"name": "pod_name",
"id": "pod_name",
"label": "Pod名称",
"searchable": true,
"clearable": true,
"visibleOn": "(this.namespace && (this.cluster || window.getCurrentClusterId)) || (this.node_name && (this.cluster || window.getCurrentClusterId))",
"source": {
"method": "get",
"url": "/k8s/pod/name/option_list",
"data": {
"ns": "${namespace}",
"node_name": "${node_name}",
"__cluster": "${ ''|selectedCluster}"
}
}
},
{
"type": "select",
"name": "log_level",
"label": "日志级别",
"placeholder": "选择级别",
"clearable": true,
"options": [
{
"label": "DEBUG",
"value": "DEBUG"
},
{
"label": "INFO",
"value": "INFO"
},
{
"label": "WARN",
"value": "WARN"
},
{
"label": "ERROR",
"value": "ERROR"
}
]
},
{
"type": "select",
"name": "source",
"label": "日志来源",
"placeholder": "选择来源",
"clearable": true,
"options": [
{
"label": "Pod容器",
"value": "pod"
},
{
"label": "系统节点",
"value": "node"
},
{
"label": "K8s组件",
"value": "system"
}
]
},
{
"type": "input-text",
"name": "keyword",
"label": "关键字",
"placeholder": "输入关键字搜索",
"clearable": true
},
{
"type": "input-datetime",
"name": "start_time",
"label": "开始时间",
"format": "YYYY-MM-DD HH:mm:ss",
"clearable": true
},
{
"type": "input-datetime",
"name": "end_time",
"label": "结束时间",
"format": "YYYY-MM-DD HH:mm:ss",
"clearable": true
}
]
},
{
"type": "divider"
},
{
"type": "crud",
"name": "globalLogTable",
"id": "globalLogTable",
"api": {
"method": "get",
"url": "/mgm/log/global/list",
"data": {
"cluster": "${ ''|selectedCluster}",
"namespace": "$namespace",
"node_name": "$node_name",
"pod_name": "$pod_name",
"log_level": "$log_level",
"source": "$source",
"keyword": "$keyword",
"start_time": "$start_time",
"end_time": "$end_time"
}
},
"autoFillHeight": true,
"autoGenerateFilter": false,
"headerToolbar": [
{
"type": "tpl",
"tpl": "共${count}条日志",
"align": "right",
"visibleOn": "${count}"
},
{
"type": "columns-toggler",
"align": "right",
"draggable": true,
"icon": "fas fa-cog",
"overlay": true
},
"reload"
],
"footerToolbar": [
{
"type": "pagination",
"align": "right"
},
{
"type": "switch-per-page",
"align": "right"
}
],
"perPage": 50,
"columns": [
{
"name": "timestamp",
"label": "时间",
"type": "datetime",
"format": "YYYY-MM-DD HH:mm:ss",
"sortable": true,
"width": 160
},
{
"name": "cluster_name",
"label": "集群",
"type": "text",
"width": 100
},
{
"name": "log_level",
"label": "级别",
"type": "text",
"width": 80
},
{
"name": "source",
"label": "来源",
"type": "text",
"width": 80
},
{
"name": "namespace",
"label": "命名空间",
"type": "text",
"width": 120
},
{
"name": "node_name",
"label": "节点",
"type": "text",
"width": 120
},
{
"name": "pod_name",
"label": "Pod",
"type": "text",
"width": 140
},
{
"name": "container",
"label": "容器",
"type": "text",
"width": 120
},
{
"name": "message",
"label": "日志内容",
"type": "text",
"popOver": {
"title": "完整日志",
"body": "<pre>${message}</pre>",
"showIcon": false
}
}
]
}
]
}