Skip to content

Add tarball integration for local and SSM calling #1745

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

Open
wants to merge 8 commits into
base: feature/DebuggerTool
Choose a base branch
from

Conversation

James-Hou22
Copy link

Description of the issue

A common pain point of customers when cutting a ticket is gathering information regarding their agent for the support team. They must sift through their agent, gather relevant files, and provide them to the support engineer. Adding a feature to gather all necessary files and compress them allows users to provide support engineers with relevant context through one command.

Description of changes

  • Created tarball generator
  • Added unit tests for generator

It is not possible to provide the triaging interactivity if the agent tarball generator is called via SSM, so if the agent detects that it is being called through SSM, it will not ask for triaging.

Output

The tarball will have the following structure:

support-bundle-YYYY-MM-DD-HHMMSS.tar.gz
├── traiging.txt
├── etc/
│   ├── amazon-cloudwatch-agent.toml
│   ├── amazon-cloudwatch-agent.json
│   ├── common-config.toml
│   ├── log-config.json
│   └── env-config.json
├── logs/
    └── amazon-cloudwatch-agent.log

If SSM is used, the tarball will not have the triaging.txt file.

License

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@James-Hou22 James-Hou22 self-assigned this Jun 27, 2025
@James-Hou22 James-Hou22 requested a review from a team as a code owner June 27, 2025 16:00
@James-Hou22 James-Hou22 removed their assignment Jun 27, 2025
Comment on lines 20 to 30
if len(os.Args) > 1 {
switch os.Args[1] {
case "--tarball":
debugger.CreateTarball(false)
return
case "--tarballssm":
debugger.CreateTarball(true)
return
}
}

Copy link
Contributor

Choose a reason for hiding this comment

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

should use flag package instead

EnvironmentChangeDesc string
}

func Triage() Answers {
Copy link
Contributor

Choose a reason for hiding this comment

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

lol, great name

tarWriter := tar.NewWriter(gzipWriter)
defer tarWriter.Close()

if err := addFileToTarball(tarWriter, paths.AgentLogFilePath, "logs/amazon-cloudwatch-agent.log", 500); err != nil {
Copy link
Contributor

Choose a reason for hiding this comment

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

why? we should include all of it

Copy link
Author

Choose a reason for hiding this comment

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

Going to go up to 50,000 lines, this attributes to about ~800KB-2MB of compressed data.

Copy link
Author

Choose a reason for hiding this comment

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

Also going to add an option for customers to turn on debug mode for logging and wait for some x seconds of gathering those logs before they get gathered and grouped to the tarball.


fmt.Println("Please answer these questions to better assist with your issue:")

fmt.Println("Is this issue once off, intermittent, or consistently happening right now? (o/i/c): ")
Copy link
Contributor

Choose a reason for hiding this comment

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

i would let them write anything, give us as much info as possible

Copy link
Author

Choose a reason for hiding this comment

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

True, I'll add a section to let them write anything they want. FYI this section is a WIP with the support team. They're going to request some more questions to be added here in the future.

answers.Occurence = strings.TrimSpace(occurence)
}

fmt.Print("Has anything changed in the environment recently? (y/n): ")
Copy link
Contributor

Choose a reason for hiding this comment

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

same thing. we should let them share when it changed, etc by just letting them type whatever.

Copy link
Author

Choose a reason for hiding this comment

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

If the user says yes they have the opportunity to write about what did change after.

@James-Hou22 James-Hou22 requested a review from the-mann June 30, 2025 16:36
Copy link
Contributor

This PR was marked stale due to lack of activity.

@github-actions github-actions bot added the Stale label Jul 10, 2025
@James-Hou22 James-Hou22 requested a review from Paramadon July 11, 2025 20:42
@github-actions github-actions bot removed the Stale label Jul 12, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants