Bug 1273948 - "--tail" doesn't work for `oc logs`
Summary: "--tail" doesn't work for `oc logs`
Keywords:
Status: CLOSED CURRENTRELEASE
Alias: None
Product: OKD
Classification: Red Hat
Component: oc
Version: 3.x
Hardware: Unspecified
OS: Unspecified
medium
medium
Target Milestone: ---
: ---
Assignee: Michail Kargakis
QA Contact: Wei Sun
URL:
Whiteboard:
Depends On:
Blocks:
TreeView+ depends on / blocked
 
Reported: 2015-10-21 14:45 UTC by Wei Sun
Modified: 2015-11-23 21:12 UTC (History)
3 users (show)

Fixed In Version:
Doc Type: Bug Fix
Doc Text:
Clone Of:
Environment:
Last Closed: 2015-11-23 21:12:51 UTC
Target Upstream Version:
Embargoed:


Attachments (Terms of Use)

Description Wei Sun 2015-10-21 14:45:33 UTC
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 16:53:58 UTC
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 17:44:49 UTC
Will be fixed post 3.1

Comment 3 Michail Kargakis 2015-10-30 16:14:49 UTC
Fixed in latest master

Comment 4 Wei Sun 2015-11-02 02:29:16 UTC
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.