# 日志的收集

> 日志收集笔记：filebeat、IOPS、日志对 CPU 与内存的影响等要点，附一段在 class / extends 小节下用原型链实现继承的 JavaScript 示例。

- 发布于: 2019-12-31
- 更新于: 2026-09-30
- 原文: https://shanyue.tech/posts/node/log-es/
- 标签: node
- 专栏: Node 牛刀小试

---

- filebeat

## IOPS

## 日志所影响的CPU及内存

## `class` / `extends`

```js
function Animal(name) {
  this.name = name;
}

Animal.prototype.hello = () => {
  console.log("hello");
};

function Dog(name, say) {
  Animal.call(this, name);
  this.say = say;
}

Dog.prototype = Object.create(Animal.prototype);

Reflect.defineProperty(Dog.prototype, "constructor", {
  value: Dog,
  enumerable: false, // 不可枚举
  writable: true,
});
```

```js
class Animal {
  constructor(name) {
    this.name = name;
  }

  hello() {
    console.log("hello");
  }
}

class Dog extends Animal {
  constructor(name, say) {
    super(name);
    this.say = say;
  }
}
```
