-
Notifications
You must be signed in to change notification settings - Fork 7.3k
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
Add docs for local
logging driver.
#6717
Add docs for local
logging driver.
#6717
Conversation
ping @anusha-ragunathan |
@@ -150,9 +150,12 @@ see more options. | |||
| [`etwlogs`](etwlogs.md) | Writes log messages as Event Tracing for Windows (ETW) events. Only available on Windows platforms. | | |||
| [`gcplogs`](gcplogs.md) | Writes log messages to Google Cloud Platform (GCP) Logging. | | |||
| [`logentries`](logentries.md) | Writes log messages to Rapid7 Logentries. | | |||
| [`local`](local.md) | Logs are stored in an custom, efficient logging format designed to cause as little overhead as possible. | |
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.
"an custom" -> "a custom"
Also reword to "designed for minimal overhead"
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.
Thanks that was a mess of a sentence.
config/containers/logging/local.md
Outdated
|
||
|
||
The `local` logging driver captures output from container's stdout/stderr and | ||
writes them to a local file on disk. The format of these files is unspecified. |
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.
WDYM by "format is unspecified" ?
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.
Trying to convey that we are not going to document the format for public consumption because we don't want people messing with these files.
Also that the format itself may change over time.
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.
Not sure if that detail is necessary here. If you feel strongly about it, I'm fine.
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.
I think so because currently people parse the json logs and it makes it impossible to change the internal structure without breaking people.
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.
Thinking a bit more. If we are expecting to change the format and dont provide any tools for parsing, do you think we should make it experimental
?
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.
I don't. It's the users choice to use it or not, gating it behind experimental just means no one will use it.
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.
Let's get @thaJeztah thoughts on this
config/containers/logging/local.md
Outdated
5, for a total of 100MB (when decompressed) of log data. | ||
|
||
The goal of this driver is to be as efficient as possible while still | ||
remaining consistent. As such log files may not be easily parseable with |
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.
"not easily parseable with standard CLI tools". This needs more explanation as to why, since it is unexpected and different behavior from the other 2 drivers that work with docker logs
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.
To me the first sentence in the paragraph explains that. Do you have some idea of what else should go here?
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.
Since this is purely to serve as a warning to users, in which case we should add it as a Note/Warning
. I prefer Note
, since it is less alarming.
config/containers/logging/local.md
Outdated
and `log-opt` keys to appropriate values in the `daemon.json` file, which is | ||
located in `/etc/docker/` on Linux hosts or | ||
`C:\ProgramData\docker\config\daemon.json` on Windows Server. For more about | ||
+configuring Docker using `daemon.json`, see |
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.
remove dubious +
config/containers/logging/local.md
Outdated
located in `/etc/docker/` on Linux hosts or | ||
`C:\ProgramData\docker\config\daemon.json` on Windows Server. For more about | ||
+configuring Docker using `daemon.json`, see | ||
+[daemon.json](/engine/reference/commandline/dockerd.md#daemon-configuration-file). |
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.
remove dubious + here as well
9e135e2
to
13ef02f
Compare
@anusha-ragunathan I think I get your confusion; The short answerWe must be explicit that this logging-driver uses an internal storage format that is not for external consumption, and that the format can change at any time. Perhaps something like: The `local` logging driver captures output from container's stdout/stderr and
writes them to an internal storage that is optimized for performance and disk
use.
By default the `local` driver preserves 100MB of log messages per container and
uses automatic compression to reduce the size on disk.
> *Note*: the `local` logging driver currently uses file-based storage. The
> file-format and storage mechanism are designed to be exclusively accessed by
> the Docker daemon, and should not be used by external tools as the
> implementation may change in future releases. The long answer:What it comes down to, is that everything inside Now comes the tricky bit;
So, as a result;
Because of the above: even though the json-file log-format was intended to be an internal format ("implementation detail"), it has now become an unofficial public API. We can't change it without breaking many people. So, what we need is;
|
| Option | Description | Example value | | ||
|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------| | ||
| `max-size` | The maximum size of the log before it is rolled. A positive integer plus a modifier representing the unit of measure (`k`, `m`, or `g`). Defaults to 20MB. | `--log-opt max-size=10m` | | ||
| `max-file` | The maximum number of log files that can be present. If rolling the logs creates excess files, the oldest file is removed. **Only effective when `max-size` is also set.** A positive integer. Defaults to 5. | `--log-opt max-file=3` | |
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.
I should probably comment this on the implementation PR, but isn't "max file" an implementation detail? Can we abstract storage even more, and just allow people to set "max amount of logs to keep" ?
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.
This stayed as max-file
in the implementation.
|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------| | ||
| `max-size` | The maximum size of the log before it is rolled. A positive integer plus a modifier representing the unit of measure (`k`, `m`, or `g`). Defaults to 20MB. | `--log-opt max-size=10m` | | ||
| `max-file` | The maximum number of log files that can be present. If rolling the logs creates excess files, the oldest file is removed. **Only effective when `max-size` is also set.** A positive integer. Defaults to 5. | `--log-opt max-file=3` | | ||
| `compress` | Toggle compression of rotated log files. Enabled by default. | `--log-opt compress=false` | |
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.
Same here; "rotated files" is likely implementation detail; we can describe here why someone would want to disable compression (does it cause a significant overhead? discouraged for high-volume logging? discouraged for "many running containers"?).
Ideally, we'd change this to (e.g.) disable-compression
. Booleans with --enablesomething=false
are a bit awkward 😅
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.
Should we add labels
here as well? (I think it's a common option, so it may be documented as such, but could be useful to include it in every logging driver)
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.
I did not add support for labels/env/etc to the local driver.
|
||
| Option | Description | Example value | | ||
|:------------|:--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|:-----------------------------------------| | ||
| `max-size` | The maximum size of the log before it is rolled. A positive integer plus a modifier representing the unit of measure (`k`, `m`, or `g`). Defaults to 20MB. | `--log-opt max-size=10m` | |
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.
(Probably better discussed on the implementation PR, I'll comment there as well); is the storage-format suitable for doing time-based rotation as well? (see moby/moby#36853)?
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.
Not tackling this as of yet, but it's definitely possible.
Now that the implementation PR is merged, lets get the doc changes done. @cpuguy83: Can you address @thaJeztah 's concerns? |
local
logging driver.local
logging driver.
13ef02f
to
b096073
Compare
Updated with explicit wording about the the private nature of the implementation. |
Signed-off-by: Brian Goff <cpuguy83@gmail.com>
b096073
to
889153d
Compare
Deploy preview for modest-edison-79d82e ready! Built with commit b096073 https://deploy-preview-6717--modest-edison-79d82e.netlify.com |
Deploy preview for modest-edison-79d82e ready! Built with commit 889153d https://deploy-preview-6717--modest-edison-79d82e.netlify.com |
@anusha-ragunathan Do you approve of the last change? Are you ready for me to merge now? |
LGTM |
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.
LGTM
Proposed changes
Add docs for moby/moby#37092
Unreleased project version (optional)
Depends on the above mentioned PR being merged