Hide Forgot
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:
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
*** Bug 1728910 has been marked as a duplicate of this bug. ***
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?
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.
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"
Ok, per https://bugzilla.redhat.com/show_bug.cgi?id=1728105#c4, will verify this issue.
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