# Can I use filebeat to send its own logs to Elasticsearch?

**URL:** <https://discuss.elastic.co/t/can-i-use-filebeat-to-send-its-own-logs-to-elasticsearch/352090>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [January 30, 2024, 1:05pm UTC](https://discuss.elastic.co/t/can-i-use-filebeat-to-send-its-own-logs-to-elasticsearch/352090 "2024-01-30T13:05:10Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![Pooort](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/pooort/32/131232_2.png) [@Pooort](https://discuss.elastic.co/u/Pooort)\
**Post date:** [January 30, 2024, 1:05pm UTC](https://discuss.elastic.co/t/can-i-use-filebeat-to-send-its-own-logs-to-elasticsearch/352090/1 "2024-01-30T13:05:10Z")

</div>

Now I'm using `-e` to start filebeat. But I'm going to collect logs in the files, can I config filebeat to send its own logs to Elasticsearch?

---

<div class="post-metadata">

**Author:** ![yago82](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/yago82/32/97755_2.png) [@yago82](https://discuss.elastic.co/u/yago82)\
**Post date:** [January 30, 2024, 1:09pm UTC](https://discuss.elastic.co/t/can-i-use-filebeat-to-send-its-own-logs-to-elasticsearch/352090/2 "2024-01-30T13:09:17Z")

</div>

Hi,

you need to ensure that Filebeat is logging to a file. You can do this by setting the `logging.to_files` option to `true` in your `filebeat.yml` configuration file:

```auto
logging.to_files: true
logging.files.path: /var/log/filebeat
logging.files.name: filebeat.log

```

This will make Filebeat log its output to a file named `filebeat.log`.

Then you need to set up Filebeat to read its own log file and send it to Elasticsearch. You can do this by adding a new input to the `filebeat.inputs` section of your `filebeat.yml` configuration file:

```auto
filebeat.inputs:
- type: log
  paths:
    - /var/log/filebeat/filebeat.log

```

Regards

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/elastic/original/3X/1/a/1ac57faf039f6b580b3f104ef42a2a89e41014de.png) [@system](https://discuss.elastic.co/u/system)\
**Post date:** [February 27, 2024, 3:09pm UTC](https://discuss.elastic.co/t/can-i-use-filebeat-to-send-its-own-logs-to-elasticsearch/352090/3 "2024-02-27T15:09:37Z")

</div>

This topic was automatically closed 28 days after the last reply. New replies are no longer allowed.
