Hi,  I need your help

I'm having some trouble with `C.close()`, which is declared as: `int
close(int fd)`.

I want to flush the cache of a file via the control API, by calling the
`C.close()`
method. I tried to use a global variable to store the return value of
`C.open()`,
but when I send a request to the control API, the `fd` is always empty.
What should I do to get the exact `fd` ?

Any better suggestions? Look forward to your guidance and advice!

Best regards!

Qi Guo <guoq...@gmail.com> 于2021年12月13日周一 11:40写道:

> Get it,
> thank you for your advice, it has been very beneficial!
>
> Best regards!
>
> Zexuan Luo <spacewan...@apache.org> 于2021年12月10日周五 上午9:44写道:
>
>> The plugin can't be integrated with log-rotate as its fds are not
>> managed by Nginx.
>> We can develop a separate log-rotate feature in this plugin, or just
>> let users manage the lifecycle of the log file.
>>
>> Just drop some of my concerns here:
>> 1. maybe we can use file-logger as plugin name, as we already have
>> *-logger plugins
>> 2. like other loggers, we can use a custom log format via metadata.
>> See
>> https://github.com/apache/apisix/blob/c178435d7ada4eeb713d9a1688fb5f54f971abdf/apisix/plugins/http-logger.lua#L188
>> 3. reopen per request is too expensive, maybe we can register a
>> control API, and reopen part of the files when the API is hit.
>>
>> Qi Guo <guoq...@gmail.com> 于2021年12月9日周四 16:22写道:
>> >
>> > Hi,
>> >
>> > > What’s the meaning for this? IMHO, it’ll add more overheads.
>> >
>> > My initial thought was that this would make it easier to develop and
>> debug
>> > locally
>> > to get a better view of the data being requested.
>> > This does add more overhead if there are too many requests. We cloud
>> open it
>> > only when we are debugging a problem.
>> >
>> > > Also, can we use it with the log-rotate plugin? Or how can we control
>> the
>> > file size?
>> >
>> > I'm sorry I missed this, can I pass the path of the file-log
>> configuration
>> > to log-rotate to keep it working.
>> > What do I need to do to do this and can you give me some good advice?
>> >
>> > Best wishes to you!
>> >
>> > Chao Zhang <zchao1...@gmail.com> 于2021年12月9日周四 上午9:51写道:
>> >
>> > > Hi,
>> > >
>> > > > you can set whether to close and reopen the log file on each request
>> > >
>> > > What’s the meaning for this? IMHO, it’ll add more overheads.
>> > >
>> > > Also, can we use it with the log-rotate plugin? Or how can we control
>> the
>> > > file size?
>> > >
>> > >
>> > > Chao Zhang
>> > > https://github.com/tokers
>> > >
>> > > On December 8, 2021 at 23:04:15, Qi Guo (guoq...@gmail.com) wrote:
>> > >
>> > > 3. you can set whether to close and reopen the log file on each
>> request,
>> > >
>> > >
>>
>

Reply via email to