# @elastic/makelogs 中文文档

规范地址：https://npmcn.com/package/%40elastic/makelogs/

版本：6\.1\.1
npm 元数据更新时间：2026-09-25T13:38:50.722Z
中文译文更新时间：2026-11-13T10:40:12.316Z
软件包许可：Apache-2\.0

本文由上游 README 翻译，可能存在偏差，请结合原文核对 API、命令与配置。版权与许可归原作者所有。

原始 npm 页面：https://www.npmjs.com/package/%40elastic/makelogs
原文对照：https://npmcn.com/package/%40elastic/makelogs/?lang=original
项目主页：https://github.com/elastic/makelogs
源码仓库：https://github.com/elastic/makelogs

## 关键信息（来自 npm 元数据）

- 包体积（解压后）：1.5 MB，35 个文件
- 模块格式：CommonJS
- TypeScript 类型：未声明
- 运行依赖：7 个
- 首次发布：2019-02-07T22:39:01.270Z
- 最新版本发布：2022-10-28T18:25:52.349Z
- 近 30 天下载量：211234（2026-10-14 至 2026-11-12，npm 官方下载统计）
- 已发布版本数：7（近 12 个月 0 个）

## 中文简介

测试 kibana 的简单日志生成器

## 安装

```sh
npm install @elastic/makelogs
```

也可以使用：`pnpm add @elastic/makelogs`、`yarn add @elastic/makelogs`、`bun add @elastic/makelogs`

## README

# @ 有弹性/ makelogs

简单的生成器用来将假的HTTP流量日志推入弹性搜索. 它使用节点.js客户端.

这个makelogs的版本被设计为与从弹性搜索大师所创建的最新架构相配合,与之前的版本不相容.

事件被推向 `logstash-YYYY.MM.DD` 格式化索引(可使用 `--indexPrefix`),使用散装API,并易被克巴纳所消耗.

文件是这样的:

```json
{
  "_index": "logstash-2014.06.17",
  "_type": "_doc",
  "_id": "706786",
  "_score": 11.412156,
  "_source": {
     "index": "logstash-2014.06.17",
     "@timestamp": "2014-06-17T17:00:27.053Z",
     "ip": "225.27.202.82",
     "extension": "html",
     "response": "200",
     "geo": {
        "coordinates": [
           44.23107,
           -94.99893444
        ],
        "src": "IM",
        "dest": "PK",
        "srcdest": "IM:PK"
     },
     "@tags": [
        "error",
        "info"
     ],
     "utc_time": "2014-06-17T17:00:27.053Z",
     "referer": "http://nytimes.com/error/gemini-11",
     "agent": "Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1",
     "clientip": "225.27.202.82",
     "bytes": 5108.1583889899775,
     "request": "/ivan-bella.html",
     "@message": "225.27.202.82 - - [2014-06-17T17:00:27.053Z] \"GET /ivan-bella.html HTTP/1.1\" 200 5108.1583889899775 \"-\" \"Mozilla/5.0 (X11; Linux x86_64; rv:6.0a1) Gecko/20110421 Firefox/6.0a1\"",
     "spaces": "this   is   a   thing    with lots of     spaces       wwwwoooooo",
     "xss": "<script>console.log(\"xss\")</script>",
     "headings": [
        "<h3>robert-satcher</h5>",
        "http://twitter.com/success/scott-altman"
     ],
     "links": [
        "mamoru-mohri@www.slate.com",
        "http://www.slate.com/info/boris-yegorov",
        "www.twitter.com"
     ],
     "machine": {
        "os": "win 7",
        "ram": 17179869184
     }
  }
}
```

## 要安装

```sh
npm install -g @elastic/makelogs
```

然后运行 `makelogs --help` 用于用户信息 :

```
$ ./bin/makelogs --help
A utility to generate sample log data.

Usage: node ./bin/makelogs@beta [options]

Options:
  ...
```

诚然,这个工具不是超能的。 告诉它你想要多少事件, 需要多少天来生成数据, 它会游走.

# 不要在生产弹性搜索装置上使用它.

事件流可以是tad unfuse,并且可能对负载下弹性搜索集群造成一些破坏. 它是为本地调试而设计的.

## 常见问题

### @elastic/makelogs 是什么？

测试 kibana 的简单日志生成器

### 如何安装 @elastic/makelogs？

在项目目录运行 npm install @elastic/makelogs，或使用 pnpm add / yarn add / bun add。它还提供命令行工具 makelogs，可以用 npx makelogs 直接运行。

### @elastic/makelogs 支持 TypeScript 吗？

该包的 package\.json 没有声明类型入口。需要类型提示时，可以在 npm 上查找社区维护的 @types/elastic\_\_makelogs 是否存在。

### @elastic/makelogs 支持 ESM 还是 CommonJS？

以 CommonJS 形式发布，可以直接 require\(\)；在 ES Module 项目中也可以用 import 引入（Node\.js 会把 module\.exports 作为默认导出）。

### @elastic/makelogs 可以商用吗？

@elastic/makelogs 使用 Apache-2\.0 许可。宽松许可：允许商业使用、修改和再分发，并附带明确的专利授权；分发时需保留许可与 NOTICE 文件，修改过的文件要注明改动。以上为概括，不构成法律意见，请以许可原文为准。

### @elastic/makelogs 的下载量有多少？

根据 npm 官方下载统计，@elastic/makelogs 在 2026/10/14 – 2026/11/12 这 30 天内被下载 211,234 次，日均约 7,041 次。下载量会把 CI 构建、镜像同步和作为其他包依赖的安装一并计入，适合横向比较热度，不能直接等同于使用人数。

### @elastic/makelogs 还在维护吗？

最新版本 6\.1\.1 发布于 2022/10/29（4 年前）；至今共发布 7 个版本，其中过去 12 个月发布了 0 个；首次发布于 2019/02/08。发布频率只是参考信号：功能稳定的工具可能很少需要更新，建议结合源码仓库的 issue 和提交记录判断。

