ionos-cloud / ionosctl

The IONOS Cloud CLI (ionosctl) gives the ability to manage IONOS Cloud infrastructure directly from Command Line.
Apache License 2.0
28 stars 6 forks source link

Unable to retrieve dbaas postgres logs with output format text, only with IONOS_LOG_LEVEL=trace #401

Closed bm-skutzke closed 9 months ago

bm-skutzke commented 10 months ago

Description

The command

$ ionosctl dbaas postgres logs list --cluster-id <cluster-id> --output text

doesn't work in 6.7.x versions of ionosctl, the last working version is 6.6.10.

When adding --verbose it's just showing:

[INFO] Cluster ID: <cluster-id>
[INFO] Since: 1m. StartTime [RFC3339 format]: 2023-11-14 15:02:46.725978962 +0000 UTC
[INFO] Direction: BACKWARD
[INFO] Limit: 2
[INFO] Getting Logs for the specified Cluster...

But no log messages are returned. The output formats json and api-json are working fine.

Executing

$ IONOS_LOG_LEVEL=trace ionosctl dbaas postgres logs list --cluster-id <cluster-id> --output text

returns the the logs, see below.

Expected behavior

Log messages are returned in text format.

Environment

Ionosctl version:

6.7.0
6.7.1

OS:

Fedora 38
Alpine 3.4.18

Shell:

bash
sh

How to Reproduce

$ ionosctl dbaas postgres logs list --cluster-id <cluster-id> --output text

Error and Debug Output

$ ionosctl dbaas postgres logs list --cluster-id <id> --output text --verbose
[INFO] Cluster ID: <cluster-id>
[INFO] Since: 1m. StartTime [RFC3339 format]: 2023-11-14 15:02:46.725978962 +0000 UTC
[INFO] Direction: BACKWARD
[INFO] Limit: 2
[INFO] Getting Logs for the specified Cluster...

-> But no log message are returned.

$ IONOS_LOG_LEVEL=trace ionosctl dbaas postgres logs list --cluster-id <cluster-id> --output text
IONOSLOG 2023/11/14 16:22:31  DumpRequestOut : GET /cloudapi/v6/?depth=0&maxResults=1&pretty=true HTTP/1.1
Host: api.ionos.com
User-Agent: ionosctl/v6.7.1_ionos-cloud-sdk-go/v6.1.8
Accept: application/json
Authorization: Bearer <token>
Accept-Encoding: gzip

IONOSLOG 2023/11/14 16:22:31 
 try no: 1
IONOSLOG 2023/11/14 16:22:31 
 DumpResponse : HTTP/2.0 200 OK
Access-Control-Allow-Credentials: true
Access-Control-Allow-Headers: *
Access-Control-Allow-Methods: *
Access-Control-Allow-Origin: *
Access-Control-Expose-Headers: *
Content-Type: application/json
Date: Tue, 14 Nov 2023 15:22:31 GMT
Server: nginx
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Frame-Options: SAMEORIGIN
X-Ratelimit-Burst: 900
X-Ratelimit-Limit: 1150
X-Ratelimit-Remaining: 899

{
  "href" : "https://api.ionos.com/cloudapi/v6/",
  "name" : "CLOUD API",
  "version" : "6.0"
}

IONOSLOG 2023/11/14 16:22:31  DumpRequestOut : GET /databases/postgresql/clusters/<cluster-id>/logs?direction=BACKWARD&limit=100 HTTP/1.1
Host: api.ionos.com
User-Agent: ionosctl/v6.7.1_ionos-cloud-sdk-go-dbaas-postgres/v1.1.1
Accept: application/json
Authorization: Bearer <token>
Accept-Encoding: gzip

IONOSLOG 2023/11/14 16:22:31 
 try no: 1
IONOSLOG 2023/11/14 16:22:32 
 DumpResponse : HTTP/2.0 200 OK
Content-Type: application/json; charset=utf-8
Date: Tue, 14 Nov 2023 15:22:32 GMT
Ionos-Request-Id: a8a67cd18b572d85a700d3914cddb19c
Server: nginx
Strict-Transport-Security: max-age=15724800; includeSubDomains
Strict-Transport-Security: max-age=31536000; includeSubDomains
Vary: Origin
X-Content-Type-Options: nosniff
X-Frame-Options: DENY
X-Ratelimit-Burst: 100
X-Ratelimit-Limit: 600
X-Ratelimit-Remaining: 0

-> Response body contains log messages.

glimberea commented 10 months ago

This will be resolved by https://github.com/ionos-cloud/ionosctl/pull/402.

glimberea commented 9 months ago

The fix for this issue was included in release 6.7.2. Have a nice day!