Migrating custom Support Bundle configuration

Replicated built-in support bundles

Any Replicated installation has a built-in way to generate support bundles. These can include custom files collected from application containers and output from commands that also run in application containers. General format looks like this (starting at the root element)

support:
  timeout: 300
  files:
    - filename: ...
      source:
        replicated:
          component: Nginx
          container: my-nginx
....
  commands:
    - command: [tail, -n1000, /var/log/nginx/access.log]
      filename: ...
      source:
        replicated:
          component: Nginx
          container: my-nginx
...

More information can be found in Replicated Help Center for Native and Swarm schedulers.

Troubleshoot

The Troubleshoot product allows more flexibility in customizing support bundles. More information is available in Replicated Help Center, and full spec can be found here.

files:

Container files can be included by defining docker.container-cp item for each file or directory to be collected.

collect:
  v1:
    - docker.container-cp:
        timeout_seconds: 300
        src_path: /var/log/nginx/access.log
        container: supergoodtool-www
        output_dir: /www/access/

In this block:

  • timeout_seconds is equivalent to the global timeout value
  • src_path is equivalent to filename
  • container is the container name from which to collect logs. It replaces the source section which identifies the containers associated with the Replicated component/container YAML section. However this requires that container be named. As an alternative, the new support bundle allows selecting containers by labels. In case of Swarm, service names can also be specified.
  • output_dir has no equivalent in the original format. The value of src_path would be used to generate the path in the support bundle.

commands:

Commands can be executed in application containers and their output included in support bundle by defining docker.container-exec item for each command.

collect:
  v1:
    - docker.container-exec:
        timeout_seconds: 300
        exec_config:
          Cmd:
            - nginx
            - '-t'
        container: supergoodtool-www
        output_dir: /www/debug/

In this block:

  • timeout_seconds is equivalent to the global timeout value
  • exec_config is equivalent to command
  • container is the container name in which the command will be executed. It replaces the source section which identifies the containers associated with the Replicated component/container YAML section. However this requires that container be named. As an alternative, the new support bundle allows selecting containers by labels. In case of Swarm, service names can also be specified.
  • output_dir replaces filename

Trying to use this for docker swarm did not help.

Followed the instructions here:
https://help.replicated.com/docs/swarm/packaging-an-application/support-bundle/

but could not manage to fetch an additional file from the container.

tried both:
support:
files:
- filename: /mnt/log_drive/jboss_logs/server.log
source:
swarm:
service: liveuluc

support:
files:
- filename: /mnt/log_drive/jboss_logs/server.log
swarm:
service: liveuluc

Ohad,

I believe we need to update those docs a little! There are two different ways to set what files are collected depending on whether your customer is using the ‘external’ support bundle (also known as ‘V2’) or the built-in version. This can be set with a toggle on the license page:


If the toggle does not appear on the license page, external is enabled. External is what @dmitriy was referring to above as ‘Troubleshoot’.

Built-in support bundles are configured with the method you’ve described - a ‘support’ entry in the Replicated YAML.

support:
  timeout: 300
  files:
    - filename: /etc/os-release
      source:
        replicated:
          component: Nginx
          container: my-nginx

External bundles, which you are likely using, are configured slightly differently. Rather than being a part of the Replicated YAML, they are instead maintained separately in Replicated Console’s Troubleshoot page. The default spec there is what will be fetched when a customer generates a support bundle or an airgap license is produced.

tried to play with the support bundle spec in console and i cannot really save my changes… i manage to click “save bundle spec” and getting “all changes saved” but once i try to quit the page i am getting “You have unsaved changes. If you proceed, you will lose any of the changes you’ve made.” and changes are never saved…

Anything i am missing?? you can see “ohadtest” spec at Replicated Console

Also, saw that i can read a file from the host using os.read-file but what about reading a file from a specific container (i am using swarm)?

Hi Ohad,

For copying a file from a container you can add a label to the service spec and then use the docker.container-cp spec.

We’ll look into your issues with console.