Re: Microseconds to error log
| From: | tyson andre | Date: | Fri, 28 Oct 2022 12:26:43 +0000 |
| Subject: | Re: Microseconds to error log | ||
| References: | 1 2 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-118895@lists.php.net to get a copy of this message | ||
Hi Mikhail,
> >Basically, we have quite a high-loaded environment and we really want
> >to see timestamps containing milli-/microseconds in our logs.
>
> I'm not knowledgeable enough to comment on the implementation details, but from a user
> point of view I agree the feature would be useful. It would definitely need to be behind an ini
> setting, though, to avoid existing log parsers failing unexpectedly on the new format.
I agree that I'd want this functionality available.
I found https://www.ietf.org/rfc/rfc3164.txt for
syslogs which allows 1-6 digits after
.. (haven't checked for any followup rfcs or
how widely they are supported)
https://www.w3.org/TR/NOTE-datetime appears to
document a useful subset of the iso 8601 functionality for anything documented as accepting iso 8601
dates, which allows microseconds
> s = one or more digits representing a decimal fraction of a second
Does anyone know of commonly used tools for syslogs where the recent releases work with milliseconds
but not microseconds (I'd hope not, since syslog has been around for decades, but it'd be
useful to know)? PHP's fast so I'd agree microseconds would be useful to have, e.g.
I've wanted this when debugging the order of db/cache calls or other operations in a web app
E.g. https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Date/toISOString
(JavaScript dates and Date.now are in milliseconds)
> The toISOString() method returns a string in simplified extended ISO format (ISO 8601), which
> is always 24 or 27 characters long (YYYY-MM-DDTHH:mm:ss.sssZ or ±YYYYYY-MM-DDTHH:mm:ss.sssZ,
> respectively).
I'd agree I'd want an ini setting, e.g. for non-technical users that wanted to upgrade to
the next php minor version
without researching how to change their ad-hoc or external syslog parsers
(e.g. when logs are parsed using regex to extract the date and following fields)
An example: syslogs can be sent over the network to various services, e.g., https://www.elastic.co/guide/en/logstash/current/plugins-inputs-syslog.html#plugins-inputs-syslog-grok_pattern
Thanks,
Tyson