-
Notifications
You must be signed in to change notification settings - Fork 7
PCSM 335 use rfc 3339 format for log timestamps #69
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
6b358ee
99e6414
882fba8
0eadf1b
6e8e1ec
8242dda
a47a655
20e5330
71a8c15
0df4975
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
|
|
@@ -45,15 +45,30 @@ | |||||
|
|
||||||
| PCSM can output logs in two formats: human-readable text (default) and structured JSON. | ||||||
|
|
||||||
| #### Timestamp format | ||||||
|
|
||||||
| !!! admonition "Version added: 0.10.0" | ||||||
|
|
||||||
| PCSM writes every log timestamp in [RFC 3339 :octicons-link-external-16:](https://www.rfc-editor.org/rfc/rfc3339){:target="_blank"} format and always in UTC, also known as Zulu time. This applies to both text and JSON output. | ||||||
|
Check notice on line 52 in docs/logging.md
|
||||||
|
|
||||||
| ```{.text .no-copy} | ||||||
| 2026-06-02T10:43:46.854Z INF POST /start s=http | ||||||
| ``` | ||||||
|
|
||||||
| The format is `YYYY-MM-DDTHH:MM:SS.mmmZ`. The `T` separates the date from the time, and the trailing `Z` marks the timestamp as UTC, also known as Zulu time. | ||||||
|
|
||||||
| Using UTC provides a consistent timestamp regardless of the host's local timezone. This makes it easier to correlate PCSM logs with MongoDB logs, FTDC diagnostics, application logs, and monitoring systems without converting between local timezones. | ||||||
|
Check notice on line 60 in docs/logging.md
|
||||||
|
|
||||||
|
|
||||||
| #### Text format (default) | ||||||
|
|
||||||
| By default, logs are printed to the console in a color-coded, human-readable format. This is ideal for interactive use and manual inspection. | ||||||
|
|
||||||
| ??? example "Sample output" | ||||||
|
|
||||||
| ```text | ||||||
| 2024-10-26 14:30:01.000 INF s=http Starting HTTP server at http://localhost:2242 | ||||||
| 2024-10-26 14:30:05.123 DBG s=repl:watch op=insert ns=test.coll1 op_ts=1729953005,1 | ||||||
| 2026-06-02T10:43:46.854Z INF s=http Starting HTTP server at http://localhost:2242 | ||||||
| 2026-06-02T10:43:46.955Z DBG s=repl:watch op=insert ns=test.coll1 op_ts=1780397026,1 | ||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| ``` | ||||||
|
|
||||||
| You can disable the colorization with the `--log-no-color` flag. This is useful when redirecting log output to a file. | ||||||
|
|
@@ -81,8 +96,8 @@ | |||||
| ??? example "Sample output" | ||||||
|
|
||||||
| ```json | ||||||
| {"level":"info","s":"http","time":"2024-10-01 14:30:01.000","message":"Starting HTTP server at http://localhost:2242"} | ||||||
| {"level":"debug","s":"repl:watch","op":"insert","ns":"test.coll1","op_ts":[1729953005,1],"time":"2024-10-26 14:30:05.123"} | ||||||
| {"level":"info","s":"http","time":"2026-06-02T10:43:46.854Z","message":"Starting HTTP server at http://localhost:2242"} | ||||||
| {"level":"debug","s":"repl:watch","op":"insert","ns":"test.coll1","op_ts":[1780397026,1],"time":"2026-06-02T10:43:46.955Z"} | ||||||
| ``` | ||||||
|
|
||||||
| ### JSON field reference | ||||||
|
|
@@ -95,7 +110,7 @@ | |||||
| | `s` | string | The scope or component where the log originated (e.g., http, clone, repl). | | ||||||
| | `ns` | string | The MongoDB namespace (database.collection) related to the event. | | ||||||
| | `elapsed_secs` | float | The time taken for an operation to complete, in seconds. | | ||||||
| | `time` | string | The timestamp of the log event in YYYY-MM-DD HH:MM:SS.ms format. | | ||||||
| | `time` | string | The timestamp of the log event in RFC 3339 format, always in UTC (`YYYY-MM-DDTHH:MM:SS.mmmZ`). | | ||||||
|
Check notice on line 113 in docs/logging.md
|
||||||
| | `message` | string | The main log message. | | ||||||
| | `error` | string | The error message, if an error occurred. | | ||||||
| | `op` | string | The type of operation (e.g., insert, createIndexes). | | ||||||
|
|
||||||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Updated the six timestamped text-log examples in
docs/troubleshooting.mdto RFC 3339 UTC format in commit71a8c15.