Bug 1273948 - "--tail" doesn't work for `oc logs`
"--tail" doesn't work for `oc logs`
Status: CLOSED CURRENTRELEASE
Product: OpenShift Origin
Classification: Red Hat
Component: Command Line Interface (Show other bugs)
3.x
Unspecified Unspecified
medium Severity medium
: ---
: ---
Assigned To: Michail Kargakis
Wei Sun
: UpcomingRelease
Depends On:
Blocks:
  Show dependency treegraph
 
Reported: 2015-10-21 10:45 EDT by Wei Sun
Modified: 2015-11-23 16:12 EST (History)
3 users (show)

See Also:
Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Environment:
Last Closed: 2015-11-23 16:12:51 EST
Type: Bug
Regression: ---
Mount Type: ---
Documentation: ---
CRM:
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---


Attachments (Terms of Use)

  None (edit)
Description Wei Sun 2015-10-21 10:45:33 EDT
Description of problem:
Show the logs using "--tail",but I use different number for --tail,the logs are same.
Check `oc logs -h`:

--tail=-1: Lines of recent log file to display. Defaults to -1, showing all log lines.

Version-Release number of selected component (if applicable):
devenv-rhel_2508
# oc version
oc v1.0.6-805-g3f0e8f6
kubernetes v1.2.0-alpha.1-1107-g4c8e6f4

How reproducible:
Always

Steps to Reproduce:
1.oc logs bc/nd --tail=3 > bc1.log
2.oc logs bc/nd --tail=5 > bc2.log
3.oc logs bc/nd --tail=-1 > bc3.log
4.diff bc1.log  bc3.log
5.diff bc1.log bc2.lgo
6.diff bc2.log bc3.log
7.Check bc1.log ,bc2.log and bc3.log (logs have 785 lines)

Actual results:
7.They are same 

Expected results:
--tail should work well.

Additional info:
Comment 1 David Eads 2015-10-22 12:53:58 EDT
I think I'd like to fix this by including the PodLogOptions on the BuildLogOptions.  Be sure to keep `Follow` backwards compatible.
Comment 2 Michail Kargakis 2015-10-27 13:44:49 EDT
Will be fixed post 3.1
Comment 3 Michail Kargakis 2015-10-30 12:14:49 EDT
Fixed in latest master
Comment 4 Wei Sun 2015-11-01 21:29:16 EST
Verified in the devenv-rhel7_2619

Result:
1.# oc logs bc/rubytest -n wsuntest --tail=3
I1102 02:24:16.093908       1 sti.go:221] Using provided push secret for pushing 172.30.125.194:5000/wsuntest/rubytest:latest image
I1102 02:24:16.093934       1 sti.go:225] Pushing 172.30.125.194:5000/wsuntest/rubytest:latest image ...
I1102 02:25:16.835121       1 sti.go:241] Successfully pushed 172.30.125.194:5000/wsuntest/rubytest:latest

2.# oc logs bc/rubytest -n wsuntest --tail=5
I1102 02:24:10.638399       1 sti.go:448] It was installed into ./bundle
I1102 02:24:10.653591       1 sti.go:448] ---> Cleaning up unused ruby gems ...
I1102 02:24:16.093908       1 sti.go:221] Using provided push secret for pushing 172.30.125.194:5000/wsuntest/rubytest:latest image
I1102 02:24:16.093934       1 sti.go:225] Pushing 172.30.125.194:5000/wsuntest/rubytest:latest image ...
I1102 02:25:16.835121       1 sti.go:241] Successfully pushed 172.30.125.194:5000/wsuntest/rubytest:latest

3.# oc logs bc/rubytest -n wsuntest --tail=-1
Already on 'master'
I1102 02:24:06.247261       1 sti.go:448] ---> Installing application source ...
I1102 02:24:06.248976       1 sti.go:448] ---> Building your Ruby application from source ...
I1102 02:24:06.249129       1 sti.go:448] ---> Running 'bundle install ' ...
I1102 02:24:09.095606       1 sti.go:448] Fetching gem metadata from https://rubygems.org/..........
I1102 02:24:09.459085       1 sti.go:448] Resolving dependencies...
I1102 02:24:10.637763       1 sti.go:448] Installing rack (1.6.4) 
I1102 02:24:10.637857       1 sti.go:448] Using bundler (1.3.5) 
I1102 02:24:10.638319       1 sti.go:448] Your bundle is complete!
I1102 02:24:10.638399       1 sti.go:448] It was installed into ./bundle
I1102 02:24:10.653591       1 sti.go:448] ---> Cleaning up unused ruby gems ...
I1102 02:24:16.093908       1 sti.go:221] Using provided push secret for pushing 172.30.125.194:5000/wsuntest/rubytest:latest image
I1102 02:24:16.093934       1 sti.go:225] Pushing 172.30.125.194:5000/wsuntest/rubytest:latest image ...
I1102 02:25:16.835121       1 sti.go:241] Successfully pushed 172.30.125.194:5000/wsuntest/rubytest:latest

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