# Nginx access and error logs show incorroct value in kibana dashboard

**URL:** <https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453>\
**Category:** Kibana\
**Created:** [April 7, 2021, 11:52am UTC](https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453 "2021-04-07T11:52:12Z")\
**Posts on this page:** 4\
**Page:** 2

<div class="post-metadata">

**Author:** ![stephenb](https://sea2.discourse-cdn.com/elastic/user_avatar/discuss.elastic.co/stephenb/32/40856_2.png) [@stephenb](https://discuss.elastic.co/u/stephenb)\
**Post date:** [April 15, 2021, 2:14am UTC](https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453/21 "2021-04-15T02:14:03Z")

</div>

Ok here we go 🙂

First your error logs seem to parse fine so I think you are good there.

I am pretty sure the other number is request body bytes so I created a custom pipeline.

So here is what you can do....

1. I created a custom pipeline it was a pretty simple fix. You can find it [here](https://gist.githubusercontent.com/bvader/e2931f7640469e2c29956a736f510c21/raw/69a577f4e0840b9fbbc2f0b1c67c79dcf28dd1f4/filebeat-7.12.0-nginx-custom-access-pipeline.json) bvader that is me.  
Be very careful copying make sure you copy from the raw.

2. Run those commands in the dev tool that will add the custom pipeline...

If you want to know the difference it is the grok.

default

`... %{NUMBER:http.response.status_code:long} %{NUMBER:http.response.body.bytes:long} \"(-|%{DATA:http.request.referrer})\" ...`

The new one with the new field.

`....%{NUMBER:http.response.status_code:long} %{NUMBER:http.response.body.bytes:long} %{NUMBER:http.request.body.bytes:long} \"(-|%{DATA:http.request.referrer})\"....`

1. Now this is important and it can be confusing do not put the new pipeline on the output, when you configure it on the input it will end up in the right metadata fields and will override the default pipeline which is what we want. If you put it on the output the default pipeline will override the custom pipeline we just created and it will not work.

filebeat/modules.d/nginx.yml

```
- module: nginx
  # Access logs
  access:
    enabled: true
    input:
      pipeline: filebeat-7.12.0-nginx-custom-access-pipeline
    var.paths: ["/var/log/nginx/access.log"]

```

1. Clean up the filebeat registry from the filebeat directory  
`rm -fr ./data`

2. Run Filebeat

Here is a little screen shot of the 3 rows I even put in a real IP address. The user agent failed I think because they are fake.

 ![Screen Shot 2021-04-14 at 7.08.12 PM](https://us1.discourse-cdn.com/elastic/original/3X/1/8/184994fa4adcfdb33dbba61df1a6a61fd751ed53.jpeg)

The Errors worked too...

 ![Screen Shot 2021-04-14 at 7.11.53 PM](https://us1.discourse-cdn.com/elastic/original/3X/f/5/f557befed40aa5f2dc276695ed0d2b1393f79b01.png)

---

<div class="post-metadata">

**Author:** ![fati](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@fati](https://discuss.elastic.co/u/fati)\
**Post date:** [April 17, 2021, 5:13am UTC](https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453/22 "2021-04-17T05:13:17Z")

</div>

Thank you so much @stephenb

This is my nginx log config:

```auto
http {
    log_format main '$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent $bytes_sent "$http_referer" '
                      '"$http_user_agent" "$http_x_forwarded_for" '
                      '"$request_body"';

```

First I change log format to standard and check the result, if no problem I will try your solution and give feedback.

---

<div class="post-metadata">

**Author:** ![fati](https://avatars.discourse-cdn.com/v4/letter/f/df705f/32.png) [@fati](https://discuss.elastic.co/u/fati)\
**Post date:** [April 17, 2021, 6:46am UTC](https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453/23 "2021-04-17T06:46:42Z")

</div>

Thank you so so much @stephenb  
I changed my nginx log config based on standard format:

```auto
'$remote_addr - $remote_user [$time_local] "$request" '
                      '$status $body_bytes_sent $bytes_sent "$http_referer" '
                      '"$http_user_agent" ';

```

And now everything is ok  
I will try your solution in custom log format and will feedback.

Thanks again.

---

<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:** [May 15, 2021, 6:46am UTC](https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453/24 "2021-05-15T06:46:55Z")

</div>

Closed on May 15, 2021, 6:46am UTC

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

[Previous page](https://discuss.elastic.co/t/nginx-access-and-error-logs-show-incorroct-value-in-kibana-dashboard/269453.md?page=1)
