kibana中Visualize失效的解决办法

kibana中Visualize失效的解决办法

背景

    当我们在kibana(如图1-1所示)中辛辛苦苦建立很多个Visual,但是过了几天打开发现变成了,如图1-2 和图1-3的情况,根据提示好像,我们只能够进行重建Visualize,但是重建也是一个不小的人力成本。下面将给出具体的原因和解决办法。
在这里插入图片描述
                                                                                         图 1-1 kibana中visualize
在这里插入图片描述
                                                                                         图 1-2
在这里插入图片描述
                                                                                         图 1-3

原因

    出现上述情况主要是,索引模式被重建了,导致索引模式的id被改变;因为Viusalize是根据索引模式创建的,换句话说只要索引模式不被重建就一般是不会出现Visualize中的视图失效的。这里讲一下什么是索引模式?请看图2-1。(注意:这里不建议大家都去创建索引模式,和重建索引模式;建议统一由管理人员去操作。)
在这里插入图片描述
                                                                                        图2-1 索引模式
    visualize中的视图是通过索引模式的id去查找到它所需的元信息,然后再去定位查找数据。索引模式被重新创建,索引模式的id发生了变化,自然是无法查找到元信息,从而视图失效。

解决办法

    解决办法:(1)重新创建图(当然这是比较耗时间的),(2)查找到你创建的visualize视图需要的索引模式的id。下面,我来介绍下第二种方法。
    查找索引模式的新id;可以在kibana中dev Tools直接查如图3-1。
在这里插入图片描述
                                                                                        图3-1 获取指定索引模式的id

GET /.kibana/doc/_search
{
  "query" :{
  "match" :{
  "index-pattern.title": "test-*"  #索引模式名称
    }
  }
}

    拿到这个新的索引模式id(如图3-1中ccab3d40-a218-11e9-b876-8b6af3af7a33)之后,再去如图1-2中箭头所指位置,替换掉所有原来旧的索引模式ID,保存即刻生效;失效的visualize又可以正常使用。
    假如只知道旧的索引模式id,忘记我们自己创建了,哪些视图;那么我们可以通过,拿着旧的索引模式id去查询出该索引模式原来关联着的visualize视图。请参看图3-2,示例如下:

GET /.kibana/doc/_search
{
  "query": {
    "match": {
      "visualization.kibanaSavedObjectMeta.searchSourceJSON": "ccab3d40-a218-11e9-b876-8b6af3af7a33" 
    }
  }
}

在这里插入图片描述
                                                                                         图3-2 通过索引模式id获取关联的viusalize视图

    这里在说一下,.kibana这个东西,这个索引是kibana的系统索引,几乎kibana面板中的大部分信息都放在了这个索引里面,包括创建的索引模式,visualize视图等等这些东西。
     注意:有没有更快捷的办法,当然有,那就是通过程序代码做替换(完成上面第二种方法的逻辑);但是我并不推荐一般使用者去做这个操作,因为.kibana里面保存的有系统索引信息,操作不安全。

{"type":"log","@timestamp":"2025-06-24T14:50:24+08:00","tags":["info","plugins-system","standard"],"pid":479830,"message":"Stopping all plugins."} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["info","plugins-service"],"pid":482777,"message":"Plugin \"metricsEntities\" is disabled."} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["info","http","server","Preboot"],"pid":482777,"message":"http server running at http://0.0.0.0:5601"} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["warning","config","deprecation"],"pid":482777,"message":"“logging.dest”已过时,将在 8.0 中移除。要设置目标前移,可以在日志记录配置中使用“console”追加器,或定义定制追加器。"} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["warning","config","deprecation"],"pid":482777,"message":"Starting in 8.0, the Kibana logging format will be changing. This may affect you if you are doing any special handling of your Kibana logs, such as ingesting logs into Elasticsearch for further analysis. If you are using the new logging configuration, you are already receiving logs in both old and new formats, and the old format will simply be going away. If you are not yet using the new logging configuration, the log format will change upon upgrade to 8.0. Beginning in 8.0, the format of JSON logs will be ECS-compatible JSON, and the default pattern log format will be configurable with our new logging system. Please refer to the documentation for more information about the new logging format."} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["warning","config","deprecation"],"pid":482777,"message":"The default mechanism for Reporting privileges will work differently in future versions, which will affect the behavior of this cluster. Set \"xpack.reporting.roles.enabled\" to \"false\" to adopt the future behavior before upgrading."} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["warning","config","deprecation"],"pid":482777,"message":"从 8.0 开始,用户会话将在处于非活动状态 8 小时后自动超时。覆盖此值以更改超时。"} {"type":"log","@timestamp":"2025-06-24T14:50:36+08:00","tags":["warning","config","deprecation"],"pid":482777,"message":"从 8.0 开始,将在 30 天后自动要求用户重新登录。覆盖此值以更改超时。"} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["info","plugins-system","standard"],"pid":482777,"message":"Setting up [113] plugins: [translations,licensing,globalSearch,globalSearchProviders,features,licenseApiGuard,code,usageCollection,xpackLegacy,taskManager,telemetryCollectionManager,telemetryCollectionXpack,kibanaUsageCollection,share,embeddable,uiActionsEnhanced,screenshotMode,banners,telemetry,newsfeed,mapsEms,mapsLegacy,kibanaLegacy,fieldFormats,expressions,dataViews,charts,esUiShared,bfetch,data,savedObjects,presentationUtil,expressionShape,expressionRevealImage,expressionRepeatImage,expressionMetric,expressionImage,customIntegrations,home,searchprofiler,painlessLab,grokdebugger,management,watcher,licenseManagement,advancedSettings,spaces,security,savedObjectsTagging,reporting,canvas,lists,ingestPipelines,fileUpload,encryptedSavedObjects,dataEnhanced,cloud,snapshotRestore,eventLog,actions,alerting,triggersActionsUi,transform,stackAlerts,ruleRegistry,visualizations,visTypeXy,visTypeVislib,visTypeVega,visTypeTimelion,visTypeTagcloud,visTypeTable,visTypePie,visTypeMetric,visTypeMarkdown,tileMap,regionMap,expressionTagcloud,expressionMetricVis,console,graph,fleet,indexManagement,remoteClusters,crossClusterReplication,indexLifecycleManagement,dashboard,maps,dashboardMode,dashboardEnhanced,visualize,visTypeTimeseries,rollup,indexPatternFieldEditor,lens,cases,timelines,discover,osquery,observability,discoverEnhanced,dataVisualizer,ml,uptime,securitySolution,infra,upgradeAssistant,monitoring,logstash,enterpriseSearch,apm,savedObjectsManagement,indexPatternManagement]"} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["info","plugins","taskManager"],"pid":482777,"message":"TaskManager is identified by the Kibana UUID: 77d9d0a0-6e2c-40b8-88ac-fc11ac026f06"} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["warning","plugins","security","config"],"pid":482777,"message":"Generating a random key for xpack.security.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.security.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command."} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["warning","plugins","security","config"],"pid":482777,"message":"Session cookies will be transmitted over insecure connections. This is not recommended."} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["warning","plugins","security","config"],"pid":482777,"message":"Generating a random key for xpack.security.encryptionKey. To prevent sessions from being invalidated on restart, please set xpack.security.encryptionKey in the kibana.yml or use the bin/kibana-encryption-keys command."} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["warning","plugins","security","config"],"pid":482777,"message":"Session cookies will be transmitted over insecure connections. This is not recommended."} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["warning","plugins","reporting","config"],"pid":482777,"message":"为 xpack.reporting.encryptionKey 生成随机密钥。为防止会话在重启时失效,请在 kibana.yml 中设置 xpack.reporting.encryptionKey 或使用 bin/kibana-encryption-keys 命令。"} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["info","plugins","encryptedSavedObjects"],"pid":482777,"message":"Hashed 'xpack.encryptedSavedObjects.encryptionKey' for this instance: BQrB8dUsBGlAaZ1eq5SwFcYUCjFJrtTroWs/ofYlvTs="} {"type":"log","@timestamp":"2025-06-24T14:50:37+08:00","tags":["info","plugins","ruleRegistry"],"pid":482777,"message":"Installing common resources shared between all indices"} {"type":"log","@timestamp":"2025-06-24T14:50:38+08:00","tags":["info","plugins","reporting","config"],"pid":482777,"message":"Chromium 沙盒提供附加保护层,受 Linux Ubuntu OS 支持。自动启用 Chromium 沙盒。"} {"type":"log","@timestamp":"2025-06-24T14:50:38+08:00","tags":["warning","process"],"pid":482777,"message":"Error [ProductNotSupportedSecurityError]: The client is unable to verify that the server is Elasticsearch due to security privileges on the server side. Some functionality may not be compatible if the server is running an unsupported product.\n at /hatech/kibana-7.17.9-linux-aarch64/node_modules/@elastic/elasticsearch/lib/Transport.js:576:19\n at onBody (/hatech/kibana-7.17.9-linux-aarch64/node_modules/@elastic/elasticsearch/lib/Transport.js:369:9)\n at IncomingMessage.onEnd (/hatech/kibana-7.17.9-linux-aarch64/node_modules/@elastic/elasticsearch/lib/Transport.js:291:11)\n at IncomingMessage.emit (node:events:525:35)\n at endReadableNT (node:internal/streams/readable:1358:12)\n at processTicksAndRejections (node:internal/process/task_queues:83:21)"} {"type":"log","@timestamp":"2025-06-24T14:50:38+08:00","tags":["error","elasticsearch-service"],"pid":482777,"message":"Unable to retrieve version information from Elasticsearch nodes. security_exception: [security_exception] Reason: unable to authenticate user [efk] for REST request [/_nodes?filter_path=nodes.*.version%2Cnodes.*.http.publish_address%2Cnodes.*.ip]"} 解决此问题
最新发布
06-25
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值