Skip to content
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

host-ctr: add a mount for system logs #2295

Merged
merged 1 commit into from
Jul 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -674,13 +674,15 @@ Here are the metrics settings:
**Important note:** this setting does not affect kernel modules that are already loaded.
You may need to reboot for a change to disallow a kernel module to take effect.
* Example user data for blocking kernel modules:

```
[settings.kernel.modules.sctp]
allowed = false

[settings.kernel.modules.udf]
allowed = false
```

* `settings.kernel.sysctl`: Key/value pairs representing Linux kernel parameters.
Remember to quote keys (since they often contain ".") and to quote all values.
* Example user data for setting up sysctl:
Expand Down Expand Up @@ -896,13 +898,14 @@ logdog
```

This will write an archive of the logs to `/var/log/support/bottlerocket-logs.tar.gz`.
This archive is accessible from host containers at `/.bottlerocket/support`.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You can also fix the URL in the code block below to reflect this path.

You can use SSH to retrieve the file.
Once you have exited from the Bottlerocket host, run a command like:

```bash
ssh -i YOUR_KEY_FILE \
ec2-user@YOUR_HOST \
"cat /.bottlerocket/rootfs/var/log/support/bottlerocket-logs.tar.gz" > bottlerocket-logs.tar.gz
"cat /.bottlerocket/support/bottlerocket-logs.tar.gz" > bottlerocket-logs.tar.gz
```

(If your instance isn't accessible through SSH, you can use [SSH over SSM](https://docs.aws.amazon.com/systems-manager/latest/userguide/session-manager-getting-started-enable-ssh-connections.html).)
Expand Down
7 changes: 7 additions & 0 deletions sources/host-ctr/cmd/host-ctr/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -708,6 +708,13 @@ func withDefaultMounts(containerID string, persistentDir string) oci.SpecOpts {
Destination: fmt.Sprintf("/var/lib/bottlerocket/inventory/application.json"),
Source: fmt.Sprintf("/usr/share/bottlerocket/application-inventory.json"),
},
// Bottlerocket logs
{
Options: []string{"bind", "ro"},
Destination: "/.bottlerocket/support",
Source: "/var/log/support",
Type: "bind",
},
}

// The `current` dir was added for easier referencing in Dockerfiles and scripts.
Expand Down