Bug 1728105 - oc adm node-logs --since today option doesn't work [NEEDINFO]
Summary: oc adm node-logs --since today option doesn't work
Keywords:
Status: CLOSED ERRATA
Alias: None
Product: OpenShift Container Platform
Classification: Red Hat
Component: oc
Version: 4.1.0
Hardware: Unspecified
OS: Unspecified
high
high
Target Milestone: ---
: 4.1.z
Assignee: Sally
QA Contact: zhou ying
URL:
Whiteboard:
: 1728910 (view as bug list)
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2019-07-09 03:52 UTC by Takayoshi Kimura
Modified: 2019-08-28 19:54 UTC (History)
6 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2019-08-28 19:54:45 UTC
Target Upstream Version:
yinzhou: needinfo? (somalley)


Attachments (Terms of Use)


Links
System ID Priority Status Summary Last Updated
Red Hat Product Errata RHBA-2019:2547 None None None 2019-08-28 19:54:54 UTC

Description Takayoshi Kimura 2019-07-09 03:52:55 UTC
Description of problem:

Related to BZ1728101, wanted to specify oc adm node-logs --since option but it doesn't work.

> $ oc adm node-logs ip-10-0-134-117.ap-northeast-1.compute.internal --since today --loglevel=7
> I0709 12:44:44.148676   12843 loader.go:359] Config loaded from file /home/nekop/.kube/config
> I0709 12:44:44.156242   12843 loader.go:359] Config loaded from file /home/nekop/.kube/config
> I0709 12:44:44.156606   12843 round_trippers.go:416] GET https://api.tkimura.aws.example.com:6443/api/v1/nodes/ip-10-0-134-117.ap-northeast-1.compute.internal
> I0709 12:44:44.156617   12843 round_trippers.go:423] Request Headers:
> I0709 12:44:44.156622   12843 round_trippers.go:426]     Accept: application/json, */*
> I0709 12:44:44.156627   12843 round_trippers.go:426]     User-Agent: oc/v1.13.4+6b97d85 (linux/amd64) kubernetes/6b97d85
> I0709 12:44:44.156633   12843 round_trippers.go:426]     Authorization: Bearer REMOVED
> I0709 12:44:44.228169   12843 round_trippers.go:441] Response Status: 200 OK in 71 milliseconds
> I0709 12:44:44.240740   12843 loader.go:359] Config loaded from file /home/nekop/.kube/config
> I0709 12:44:44.243070   12843 round_trippers.go:416] GET https://api.tkimura.aws.example.com:6443/api/v1/nodes/ip-10-0-134-117.ap-northeast-1.compute.internal/proxy/logs/journal?since=today
> I0709 12:44:44.243124   12843 round_trippers.go:423] Request Headers:
> I0709 12:44:44.243156   12843 round_trippers.go:426]     Authorization: Bearer REMOVED
> I0709 12:44:44.243171   12843 round_trippers.go:426]     Accept-Encoding: gzip
> I0709 12:44:44.243185   12843 round_trippers.go:426]     Accept: text/plain, */*
> I0709 12:44:44.243199   12843 round_trippers.go:426]     User-Agent: oc/v1.13.4+6b97d85 (linux/amd64) kubernetes/6b97d85
> I0709 12:44:44.259819   12843 round_trippers.go:441] Response Status: 400 Bad Request in 16 milliseconds
> error: ip-10-0-134-117.ap-northeast-1.compute.internal the server rejected our request for an unknown reason
> F0709 12:44:44.259977   12843 helpers.go:116] 


Version-Release number of selected component (if applicable):

OpenShift 4.1.4 AWS IPI


How reproducible:

Always


Steps to Reproduce:
1. Perform oc adm node-logs with --since option
2.
3.

Actual results:

oc adm node-logs --since command rejected


Expected results:

can get node-logs with specified since paramter


Additional info:

Comment 1 Tomáš Nožička 2019-07-11 08:58:16 UTC
this seems to be the case with other --since arguments as well like "2019-07-10 00:00:00" in https://bugzilla.redhat.com/show_bug.cgi?id=1728910

Comment 2 Tomáš Nožička 2019-07-11 08:58:57 UTC
*** Bug 1728910 has been marked as a duplicate of this bug. ***

Comment 3 Sally 2019-08-08 16:54:27 UTC
I ran with:
oc adm node-logs ip-10-0-137-206.us-west-2.compute.internal --since today --loglevel=9, saw this:

I0808 12:49:50.754508   21890 request.go:942] Response Body: parameter 'since' is invalid: date must be a relative time of the form '(+|-)[0-9]+(s|m|h|d)' or a date in 'YYYY-MM-DDTHH:MM:SSZ' form
error: ip-10-0-137-206.us-west-2.compute.internal the server rejected our request for an unknown reason

Then ran with this:

oc adm node-logs ip-10-0-137-206.us-west-2.compute.internal --since -1d

That worked :)

Work for you?

Comment 4 zhou ying 2019-08-09 10:02:33 UTC
Confirmed with Client Version: v4.1.11:

`oc adm node-logs  ip-10-0-128-221.ap-northeast-2.compute.internal --since  -1d --loglevel=9` works fine.


` oc adm node-logs  ip-10-0-128-221.ap-northeast-2.compute.internal --since today --loglevel=9`
I0809 17:48:16.984803   21034 loader.go:359] Config loaded from file /root/kubeconfig
I0809 17:48:16.991795   21034 loader.go:359] Config loaded from file /root/kubeconfig
....
I0809 17:48:17.729511   21034 request.go:942] Response Body: parameter 'since' is invalid: date must be a relative time of the form '(+|-)[0-9]+(s|m|h|d)' or a date in 'YYYY-MM-DDTHH:MM:SSZ' form
error: ip-10-0-128-221.ap-northeast-2.compute.internal the server rejected our request for an unknown reason
F0809 17:48:17.729567   21034 helpers.go:116] 


I think the error info is not accurate.

Comment 5 Sally 2019-08-12 19:23:00 UTC
I think the error msg is sufficient.  When passing '--since today' you'll see:  

'I0809 17:48:17.729511   21034 request.go:942] Response Body: parameter 'since' is invalid: date must be a relative time of the form '(+|-)[0-9]+(s|m|h|d)'  

To guide you to use '--since -1d' instead.  

The Go net/http.StatusBadRequest' error is converted by k8s apimachinery into "the server rejected our request for an unknown reason"

Comment 6 zhou ying 2019-08-13 01:39:05 UTC
Ok, per https://bugzilla.redhat.com/show_bug.cgi?id=1728105#c4, will verify this issue.

Comment 9 errata-xmlrpc 2019-08-28 19:54:45 UTC
Since the problem described in this bug report should be
resolved in a recent advisory, it has been closed with a
resolution of ERRATA.

For information on the advisory, and where to find the updated
files, follow the link below.

If the solution does not work for you, open a new bug report.

https://access.redhat.com/errata/RHBA-2019:2547


Note You need to log in before you can comment on or make changes to this bug.