Mercurial > hg > nginx
comparison src/core/ngx_connection.c @ 9225:1c9264603adc
Syslog: introduced ngx_syslog_send() error logging moderation.
Errors when logging to syslog are now logged at most once per second.
This ensures that persistent errors won't flood other logs, and spontaneous
errors, such as ENOBUFS as observed on BSD systems when syslogd cannot cope
with load, or EAGAIN as seen in similar situation on Linux, won't further
overload logging subsystem, leading to more errors.
Further, errors now can only trigger reconnects at most once per second.
This ensures that persistent errors, which cannot be fixed with reconnects,
don't trigger too much unneeded work.
Additionally, in case of connection errors, such as when syslogd is not
running, connection attempts are only made once per second.
author | Maxim Dounin <mdounin@mdounin.ru> |
---|---|
date | Fri, 01 Mar 2024 05:42:12 +0300 |
parents | 58afcd72446f |
children | 37ef53ecd6b0 |
comparison
equal
deleted
inserted
replaced
9224:c7c8354f99fa | 9225:1c9264603adc |
---|---|
1602 || err == NGX_EHOSTDOWN | 1602 || err == NGX_EHOSTDOWN |
1603 || err == NGX_EHOSTUNREACH) | 1603 || err == NGX_EHOSTUNREACH) |
1604 { | 1604 { |
1605 switch (c->log_error) { | 1605 switch (c->log_error) { |
1606 | 1606 |
1607 case NGX_ERROR_DEBUG: | |
1608 level = NGX_LOG_DEBUG; | |
1609 break; | |
1610 | |
1607 case NGX_ERROR_IGNORE_EMSGSIZE: | 1611 case NGX_ERROR_IGNORE_EMSGSIZE: |
1608 case NGX_ERROR_IGNORE_EINVAL: | 1612 case NGX_ERROR_IGNORE_EINVAL: |
1609 case NGX_ERROR_IGNORE_ECONNRESET: | 1613 case NGX_ERROR_IGNORE_ECONNRESET: |
1610 case NGX_ERROR_INFO: | 1614 case NGX_ERROR_INFO: |
1611 level = NGX_LOG_INFO; | 1615 level = NGX_LOG_INFO; |
1613 | 1617 |
1614 default: | 1618 default: |
1615 level = NGX_LOG_ERR; | 1619 level = NGX_LOG_ERR; |
1616 } | 1620 } |
1617 | 1621 |
1622 } else if (c->log_error == NGX_ERROR_DEBUG) { | |
1623 level = NGX_LOG_DEBUG; | |
1624 | |
1618 } else { | 1625 } else { |
1619 level = NGX_LOG_ALERT; | 1626 level = NGX_LOG_ALERT; |
1620 } | 1627 } |
1621 | 1628 |
1622 ngx_log_error(level, c->log, err, text); | 1629 ngx_log_error(level, c->log, err, text); |