The error_log module just throw away the oldest ones silently if the user reads the buffered error log not fast enough or the buffer configured by lua_capture_error_log is too small, resulting in unnoticed logs lost.
There should be an api to read or return a flag indicating whether any logs were discarded.
For example:
local errlog = require "ngx.errlog"
local res, err, discarded = errlog.get_logs(30)
if err then
...
end
if discarded then
-- change the filter_level (for example, from ngx.INFO to ngx.NOTICE) or do something else
local log_level = errlog.get_sys_filter_level()
errlog.set_filter_level(log_level-1)
end