# Max size of a string that can be logged in error log

**URL:** <https://www.ruby-forum.com/t/max-size-of-a-string-that-can-be-logged-in-error-log/219384>\
**Category:** NGINX\
**Created:** [May 1, 2012, 5:38pm UTC](https://www.ruby-forum.com/t/max-size-of-a-string-that-can-be-logged-in-error-log/219384 "2012-05-01T17:38:39Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![Gurdipe\_D](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/g/b77776/32.png) [@Gurdipe\_D](https://www.ruby-forum.com/u/Gurdipe_D)\
**Post date:** [May 1, 2012, 5:38pm UTC](https://www.ruby-forum.com/t/max-size-of-a-string-that-can-be-logged-in-error-log/219384/1 "2012-05-01T17:38:39Z")

</div>

Hi,

Is there a maximum size (and a corresponding tunable buffer size or  
so) for a string that can be logged in nginx Error log? I could find  
the tunable for access log (buffer=size), but not for error log.

Thanks,  
Ashish

---

<div class="post-metadata">

**Author:** ![ashishsdev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@ashishsdev](https://www.ruby-forum.com/u/ashishsdev)\
**Post date:** [May 1, 2012, 6:19pm UTC](https://www.ruby-forum.com/t/max-size-of-a-string-that-can-be-logged-in-error-log/219384/2 "2012-05-01T18:19:38Z")

</div>

Hi,

I achieved a higher size than 2048 bytes, by directly tweaking  
NGX\_MAX\_ERROR\_STR in ngx\_log.h

But still couldn’t figure out if there was a config option to change  
this.

Thanks,  
Ashish

---

<div class="post-metadata">

**Author:** ![ashishsdev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@ashishsdev](https://www.ruby-forum.com/u/ashishsdev)\
**Post date:** [May 2, 2012, 12:40pm UTC](https://www.ruby-forum.com/t/max-size-of-a-string-that-can-be-logged-in-error-log/219384/3 "2012-05-02T12:40:07Z")

</div>

Hello!

On Tue, May 01, 2012 at 08:38:01AM -0700, Ashish S wrote:

> Is there a maximum size (and a corresponding tunable buffer size or  
> so) for a string that can be logged in nginx Error log? I could find

The hard limit is in code, NGX\_MAX\_ERROR\_STR which is defined to  
2048. The limit is due to use of static buffer for logging  
errors, it’s used to avoid allocations in error logging path (as  
allocation may fail, especially if we are trying to log allocation  
error).

> the tunable for access log (buffer=size), but not for error log.

The access log line size isn’t limited. The buffer= argument is  
to reduce number of write() calls, which is helpfull in case of high  
load.

Maxim D.

---

<div class="post-metadata">

**Author:** ![ashishsdev](https://www.ruby-forum.com/letter_avatar_proxy/v4/letter/a/43a26b/32.png) [@ashishsdev](https://www.ruby-forum.com/u/ashishsdev)\
**Post date:** [May 2, 2012, 5:52pm UTC](https://www.ruby-forum.com/t/max-size-of-a-string-that-can-be-logged-in-error-log/219384/4 "2012-05-02T17:52:48Z")

</div>

Thanks for the response, maxim!

–Ashish
