You need to enable JavaScript to run this app.
优惠活动
大模型
产品
解决方案
定价
更多

如何将CloudLinux性能指标的InfluxDB记录转为Elasticsearch合规JSON?

Converting InfluxDB LVE Metrics to Elasticsearch JSON Format

Got it, let's walk through how to adapt your InfluxDB data into Elasticsearch's standard JSON structure. Elasticsearch uses a document-oriented format, so we'll map each part of your InfluxDB record logically:

Key Mapping Rules

  • The InfluxDB measurement ("lve") typically becomes your Elasticsearch index name (e.g., lve-metrics — you can name this whatever makes sense for your metric pipeline). For ES versions pre-7.x, this would map to the _type field, but since 7.x+ removed types, using the index is the standard approach.
  • The time field maps directly to Elasticsearch's @timestamp (this is the default field for time-series data, making it easier to build visualizations and run time-range queries).
  • All tags (like vm, host, etc.) can be included as top-level fields (or nested in a tags object if you prefer grouping them — both work, top-level is more query-friendly).
  • Every entry in fields becomes a top-level numeric field in the ES document.

Example Elasticsearch Document

Here's the converted JSON that fits Elasticsearch's standard format:

{
  "@timestamp": "2018-05-24T20:38:33Z",
  "vm": "myvmid",
  "host": "cpanel.bino.net",
  "user": "johndoe",
  "xpool": "mypool",
  "lNETI": 0,
  "lNETO": 0,
  "lEP": 20,
  "lMEM": 262144,
  "lCPUW": 100,
  "CPU": 0,
  "lCPU": 10000,
  "lNPROC": 100,
  "lIO": 1024,
  "lIOPS": 1024,
  "nCPU": 1,
  "NPROC": 0,
  "NETO": 0,
  "fMEMPHY": 0,
  "NETI": 0,
  "fMEM": 0,
  "IOPS": 0,
  "IO": 0,
  "fNPROC": 0,
  "EP": 0,
  "MEM": 0,
  "MEMPHY": 0,
  "fEP": 0,
  "lMEMPHY": 262144
}

Notes

  • If you're using an Elasticsearch template (recommended for time-series data), you can define the field types upfront (e.g., mark all metric fields as integer or long, and @timestamp as date). This ensures proper indexing and querying.
  • If you prefer grouping tags, you could wrap them in a tags object like this:
{
  "@timestamp": "2018-05-24T20:38:33Z",
  "tags": {
    "vm": "myvmid",
    "host": "cpanel.bino.net",
    "user": "johndoe",
    "xpool": "mypool"
  },
  // ... all metrics fields here
}

Either structure is valid — it just depends on how you want to organize your data for queries and visualizations.

内容的提问来源于stack exchange,提问作者Bino Oetomo

相关产品推荐
方舟 Agent Plan

超全模态模型 × Harness 升级,最新支持 Deepseek-V4.1-Flash、GLM-5.3 系列、Doubao-Seedream-5.0-pro、Kimi-K3 (部分), 限时 9.9 元起

最近更新时间:2026.05.28 10:10:07