Skip to content

flag indicating whether any logs were discarded when capturing error_log using the 'lua_capture_error_log' directive #510

@hachi029

Description

@hachi029

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions