tailLines and SinceTime in logging api,both not worked simultaneously

9/17/2017

I am using container engine, and my pods are hosted there.

I am trying to fetch logs, using log api :

http://localhost:8000/api/v1/namespaces/app-test/pods/designer-0/log?tailLines\=100&sinceTime\=2017-09-17T10:47:58Z

if i used both the query params separately, it works and show the proper result, but if i am using it simultaneously only the top 100 logs are returning, the sinceTime param is get ignored.

my scenario is, i need a log from a specific time, in a chunk like, 100 lines, 100 lines.. like this.

I am not sure, whether it is a bug, or it is not implemented.

-- Utkarsh Yeolekar
kubernetes
node.js

3 Answers

9/17/2017

I found this from the api reference manual

https://kubernetes.io/docs/api-reference/v1.6/

tailLines -     If set, the number of lines from the end of the logs to 
show. If not specified, logs are shown from the creation of the 
container or sinceSeconds or sinceTime

So, that means if you specify tailLines, it start from the end. I dont see any option explicitly mentioned other than limitBytes. But you will have to play around with it as it does not guarantee number of lines.

-- Tejas Pandit
Source: StackOverflow

9/18/2017

Thanks All,

I have later on recognized that, it is not ignoring the sinceTime, as the TailLines intended functionality is return the lines from the last.

So, if i mentioned the sinceTime= 10 PM yesterday, it will return the records from that time..And if also tailLines, is mentioned, so it will return the recent logs from that chunk.

So, it was working as expected. I need to play with LimitBytes for getting the logs in chunk, from that time, Instead of full logs.

-- Utkarsh Yeolekar
Source: StackOverflow

9/17/2017

tailLines=X tells the server to start that many lines from the end

sinceTime tells the server to start from the specified time

the options are mutually exclusive

-- Jordan Liggitt
Source: StackOverflow