Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > alt.os.development > #8380

Re: System log and format of log entries

From "Rod Pemberton" <boo@fasdfrewar.cdm>
Newsgroups alt.os.development
Subject Re: System log and format of log entries
Date 2015-07-15 03:23 -0400
Organization Aioe.org NNTP Server
Message-ID <op.x1sz5vjwyfako5@localhost> (permalink)
References <mo2p03$kme$1@dont-email.me>

Show all headers | View raw


On Tue, 14 Jul 2015 06:42:34 -0400, James Harris  
<james.harris.1@gmail.com> wrote:

> Anyone have a good approach to laying out entries in an OS system log?
>

No.

All I know is I don't like Linux' syslog file or dmesg output,
and Windows logs were always cryptic.

> Windows uses some binary internal format (and puts entries in there only  
> when it feels like it and when the wind is in the west). Unix uses a  
> pure-text format which begins with the date and time.

Pure text is nice.  It's readable and accessable by humans via a text
editor and text display commands.  It doesn't require an additional
program.  If it's space or tab or comma delimited, you can load it
into Excel etc.  However, the representation isn't as compact which
could require more memory in your OS or kernel, or more flushing of
data to disk.

As long as a text editor or text display commands skipped displaying
control characters, you could use control characters for extra info
only available via a special program.

> I am thinking to include two independent sources of time in each log  
> entry:
>
> 1. The normal date and time in a collatable format such as
>       yyyymmdd_hhmmss.sss[timezone]
>
> 2. A timestamp from an upcounter such as the TSC or similar

You'll need the timezone if you're using daylight saving time.
I.e., times across a time change will be off by an hour.

Personally, I'd probably do year, month day as text, timezone as text,
and the time as an integer emitted as hex, e.g., time_t from time()
or seconds from GMT etc.  The hex and timezone would allow a program
to easily parse the time, should that be needed.  The timezone would
allow for correct times if the file is large enough to maintain times
across a daylight saving time change.  If there is a rapid amount of
data being written to the file, then you'll need hours, minutes, seconds,
fractions of a second, ...  From your comments (snipped), you may
even need a raw processor clock emitted.  It seems like you're expecting
large volumes of data.

> So basically, each log entry is to have
>
>   1. the timestamp
>   2. the datetime
>   3. the text of the log entry
>
> How does that seem to you? Any suggestions to do something different to  
> that?

It's all optional, but I'd consider these:

1) counter as text or raw clock, if rapid volume, for unique message ID
2) date and time, for the admin or user
3) timezone, used with 4)
4) raw time as text, for use by a programs for correct time
5) text message, for the admin or programs

You can break the text messages into components too:

1) program or sub-system (or department)
2) error number
3) error message
...

Oh, and if you're sending it to a pager or twitter, keep the total
line lengths in mind.  E.g., one company I worked for sent 150
character messages, but only managers had 150 character pagers.
Everyone else had 75 or somesuch ...  So, the important part of
the message was never seen by most of their employees, including
their technical staff.  Eventually, about a year and half later,
this problem was discoverd.  They determined that an account had
freaked out at the cost of the pager service and changed the pager
order on his own without notifying anyone in the company.  At first,
they blamed the networking guy who filled out the purchase order ...

> Any thoughts on the principles of having OS log entries include the  
> fields as described above?

What do you mean?  Do you mean without having a C library available?


Rod Pemberton

Back to alt.os.development | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

System log and format of log entries "James Harris" <james.harris.1@gmail.com> - 2015-07-14 11:42 +0100
  Re: System log and format of log entries "James Harris" <james.harris.1@gmail.com> - 2015-07-14 11:59 +0100
  Re: System log and format of log entries "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-07-15 03:23 -0400
    Re: System log and format of log entries "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-07-15 22:46 -0400
  Re: System log and format of log entries "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-07-15 03:33 -0400
    Re: System log and format of log entries Peter Cheung <mcheung63@gmail.com> - 2015-07-15 00:47 -0700
    Re: System log and format of log entries "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-07-15 22:42 -0400
      Re: System log and format of log entries "Benjamin David Lunt" <zfysz@fysnet.net> - 2015-07-16 12:18 -0700
        Re: System log and format of log entries "Mike Gonta" <mikegonta@gmail.com> - 2015-07-16 15:50 -0400
          Re: System log and format of log entries "Benjamin David Lunt" <zfysz@fysnet.net> - 2015-07-16 13:24 -0700
            Re: System log and format of log entries "Rod Pemberton" <boo@fasdfrewar.cdm> - 2015-07-17 06:39 -0400
              Re: System log and format of log entries "Benjamin David Lunt" <zfysz@fysnet.net> - 2015-07-17 10:27 -0700
                Re: System log and format of log entries "Benjamin David Lunt" <zfysz@fysnet.net> - 2015-07-21 16:38 -0700
  Re: System log and format of log entries "James Harris" <james.harris.1@gmail.com> - 2015-07-15 15:15 +0100

csiph-web