# Sending Nginx logs to elasticsearch using Filebeat

**URL:** <https://discuss.elastic.co/t/sending-nginx-logs-to-elasticsearch-using-filebeat/167100>\
**Category:** Beats\
**Tags:** filebeat\
**Created:** [February 5, 2019, 10:57am UTC](https://discuss.elastic.co/t/sending-nginx-logs-to-elasticsearch-using-filebeat/167100 "2019-02-05T10:57:28Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Raghav\_Garg](https://avatars.discourse-cdn.com/v4/letter/r/ac8455/32.png) [@Raghav\_Garg](https://discuss.elastic.co/u/Raghav_Garg)\
**Post date:** [February 5, 2019, 10:57am UTC](https://discuss.elastic.co/t/sending-nginx-logs-to-elasticsearch-using-filebeat/167100/1 "2019-02-05T10:57:28Z")

</div>

Hello,

I am trying to send nginx logs from my app-server to log-server(elasticsearch) using filebeat. I am using Nginx module for this purpose, and it is working great.

But, I am unable to change "index" for these logs. I am trying to configure my `filebeat.yml` file to achieve this behavior.

```auto
filebeat.inputs:
- type: log
  enabled: true
  paths:
    - /home/ubuntu/project/logs/*.log
  fields:
    log_type: pm2-logs

filebeat.config.modules:
  enabled: true
  path: ${path.config}/modules.d/*.yml
  reload.enabled: true
  fields: # i have added these myself, no docs suggested it.
    log_type: nginx-logs # i have added these myself, no docs suggested it.

setup.template.name: "setup-elk"
setup.template.pattern: "setup-elk-*"

output.elasticsearch:
    index: "setup-elk-%{[fields.log_type]}-%{[beat.version]}-%{+yyyy.MM.dd}"

```

When I add `fields` to `filebeat.config.modules`, it stop sending logs to elasticsearch.

I want my pm2 logs to be saved in the different index than nginx logs. Please let me know, if you guys need more info from my side.!

---

<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:** [March 5, 2019, 10:57am UTC](https://discuss.elastic.co/t/sending-nginx-logs-to-elasticsearch-using-filebeat/167100/2 "2019-03-05T10:57:34Z")

</div>

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