Skip to main content

logs data-container

Overview#

Using spawnctl, you can get the logs of a running data container.

Command#

spawnctl logs data-container <ContainerName_Or_ContainerID>

Tutorial#

In this tutorial we will create a data image and then use it to create a data container. Then, we will get the logs of that data container.

As a prerequisite you should've followed the instructions to install spawnctl

  1. Create a file development.yaml with your data image specifications.

    sourceType: empty
    name: dev
    engine: postgresql
    version: 11.0

    In this case we want to create a PostgreSQL data image that is completely empty and is named dev.

  2. Run the following command to create a data image.

    $ spawnctl create data-image -f ./development.yaml
    Data image 'dev' (10001) created!
  3. You can verify your data image by running the following command.

    $ spawnctl get data-images
    NAME IMAGE ID ENGINE STATUS MESSAGE CREATED
    dev 10001 PostgreSQL 2 Created 2 minutes ago
  4. Create a data container from the newly created data image.

    $ spawnctl create data-container --image dev
    Data container 'dev-rambbomj' (10001) created!
    -> Host=instances.spawn.cc;Port=53223;User ID=<some_user_id>;Password=<some_password>;
  5. You can verify your data container was properly created by running the following command.

    $ spawnctl get data-containers
    NAME CONTAINER ID REVISION STATUS MESSAGE ENGINE CREATED
    dev-rambbomj 10001 rev.0 2 Running PostgreSQL 1 minute ago
  6. You can now get the logs of the data container using the spawnctl logs data-container command.

    $ spawnctl logs data-container dev-rambbomj
    2019-08-19 12:10:45.302 UTC [1] LOG: listening on IPv4 address "0.0.0.0", port 5432
    2019-08-19 12:10:45.302 UTC [1] LOG: listening on IPv6 address "::", port 5432
    2019-08-19 12:10:45.306 UTC [1] LOG: listening on Unix socket "/var/run/postgresql/.s.PGSQL.5432"
    2019-08-19 12:10:45.358 UTC [21] LOG: database system was interrupted; last known up at 2019-08-19 12:10:23 UTC
    2019-08-19 12:10:46.670 UTC [22] FATAL: the database system is starting up
    2019-08-19 12:10:49.679 UTC [23] FATAL: the database system is starting up
    2019-08-19 12:10:52.009 UTC [21] LOG: database system was not properly shut down; automatic recovery in progress
    2019-08-19 12:10:52.026 UTC [21] LOG: invalid record length at 0/1652570: wanted 24, got 0
    2019-08-19 12:10:52.026 UTC [21] LOG: redo is not required
    2019-08-19 12:10:52.065 UTC [1] LOG: database system is ready to accept connections