openbmc.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Nan Zhou <nanzhou@google.com>
To: Artem Senichev <artemsen@gmail.com>
Cc: Spencer Ku <spencer.ku@quanta.corp-partner.google.com>,
	Litzung Chen <litzung.chen@quanta.corp-partner.google.com>,
	OpenBMC Maillist <openbmc@lists.ozlabs.org>,
	Alexander Amelkin <a.amelkin@yadro.com>,
	Ed Tanous <edtanous@google.com>,
	Richard Hanley <rhanley@google.com>,
	a.senichev@yadro.com, a.filippov@yadro.com
Subject: Re: Link phosphor-hostlogger and bmcweb
Date: Wed, 26 May 2021 08:17:11 -0700	[thread overview]
Message-ID: <CAOLfGj7b0TEwqAEocAo=hGobCuZUoC4Zk9X_jY8Cs7NzQgi14w@mail.gmail.com> (raw)
In-Reply-To: <20210526085623.mhls24mmo4idu5we@gmail.com>

[-- Attachment #1: Type: text/plain, Size: 3601 bytes --]

>
> > > > 3. zlib_file.xpp, zlib_exception.xpp:
> > > > will be removed or slightly changed; we can potentially use the linux
> > > > logrotate which has built-in compression and file rotation (in this
> case
> > > > these compression utilities will be removed).
> > > > The latest log file isn't compressed any more. History log files are
> > > > still compressed.
> > > Just curious, how are you going to remove the oldest messages from the
> > > latest file in runtime? You are not going to rewrite the entire file on
> > > every input character, are you?
> >
> > The following is my current idea: we will rename the latest file to
> > something else and notify the writer (hostlogger) to close its old file
> > descriptor and open a new one (should be doable via linux logrotate and
> > inotify or some signal handlers, as logrotate is able to send some
> signals
> > to hostlogger if a rotation is performed). The writer keeps appending
> logs
> > most of the time using the same fd unless the latest file is rotated.
> This
> > should be better than truncating the file where the reader (BMCWeb) won't
> > have race conditions (it might read old snapshots but it is not a big
> deal
> > in our case).
> Currently we can keep the last N lines of the host's output, the oldest
> messages are removed. It is easy to implement with a buffer in memory.
> But how are you going to get rid of the old lines if you write data
> directly
> to the log file?
> Rotation will not help you with that (we actually don't need to store such
> old
> logs).

We plan to implement something similar to rotate count
<https://linux.die.net/man/8/logrotate> in linux logrotate. It is basically
like a ring buffer in the file system. We keep N log files. The latest log
file is in plain text and the writer keeps appending data to it. The rest
N-1 files are compressed.

On Wed, May 26, 2021 at 1:56 AM Artem Senichev <artemsen@gmail.com> wrote:

> On Tue, May 25, 2021 at 11:51:44PM -0700, Nan Zhou wrote:
> > > > 3. zlib_file.xpp, zlib_exception.xpp:
> > > > will be removed or slightly changed; we can potentially use the linux
> > > > logrotate which has built-in compression and file rotation (in this
> case
> > > > these compression utilities will be removed).
> > > > The latest log file isn't compressed any more. History log files are
> > > > still compressed.
> > > Just curious, how are you going to remove the oldest messages from the
> > > latest file in runtime? You are not going to rewrite the entire file on
> > > every input character, are you?
> >
> > The following is my current idea: we will rename the latest file to
> > something else and notify the writer (hostlogger) to close its old file
> > descriptor and open a new one (should be doable via linux logrotate and
> > inotify or some signal handlers, as logrotate is able to send some
> signals
> > to hostlogger if a rotation is performed). The writer keeps appending
> logs
> > most of the time using the same fd unless the latest file is rotated.
> This
> > should be better than truncating the file where the reader (BMCWeb) won't
> > have race conditions (it might read old snapshots but it is not a big
> deal
> > in our case).
>
> Currently we can keep the last N lines of the host's output, the oldest
> messages are removed. It is easy to implement with a buffer in memory.
> But how are you going to get rid of the old lines if you write data
> directly
> to the log file?
> Rotation will not help you with that (we actually don't need to store such
> old
> logs).
>
> --
> Regards,
> Artem Senichev
> Software Engineer, YADRO.
>

[-- Attachment #2: Type: text/html, Size: 5500 bytes --]

  reply	other threads:[~2021-05-26 15:17 UTC|newest]

Thread overview: 23+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-05-20 23:29 Link phosphor-hostlogger and bmcweb Nan Zhou
2021-05-21  6:10 ` Artem Senichev
2021-05-21 15:10   ` Nan Zhou
2021-05-21 17:25     ` Ed Tanous
2021-05-21 17:23   ` Ed Tanous
2021-05-21 17:51     ` Nan Zhou
2021-05-24  7:52       ` Artem Senichev
2021-05-24 16:27         ` Ed Tanous
2021-05-25  6:41           ` Artem Senichev
2021-05-25 15:03             ` Nan Zhou
2021-05-26  5:29               ` Nan Zhou
2021-05-26  6:11                 ` Artem Senichev
2021-05-26  6:51                   ` Nan Zhou
2021-05-26  8:56                     ` Artem Senichev
2021-05-26 15:17                       ` Nan Zhou [this message]
2021-05-26 16:08                         ` Artem Senichev
2021-05-26 16:20                           ` Nan Zhou
2021-05-26 18:21                             ` Artem Senichev
2021-05-26 19:21                               ` Nan Zhou
2021-06-11 18:31                                 ` Ed Tanous
2021-06-11 21:07                                   ` Nan Zhou
2021-06-14  6:18                                     ` Artem Senichev
2021-06-18 18:18                                       ` Nan Zhou

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to='CAOLfGj7b0TEwqAEocAo=hGobCuZUoC4Zk9X_jY8Cs7NzQgi14w@mail.gmail.com' \
    --to=nanzhou@google.com \
    --cc=a.amelkin@yadro.com \
    --cc=a.filippov@yadro.com \
    --cc=a.senichev@yadro.com \
    --cc=artemsen@gmail.com \
    --cc=edtanous@google.com \
    --cc=litzung.chen@quanta.corp-partner.google.com \
    --cc=openbmc@lists.ozlabs.org \
    --cc=rhanley@google.com \
    --cc=spencer.ku@quanta.corp-partner.google.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).