openfaas / faas-cli

Official CLI for OpenFaaS
https://www.openfaas.com/
Other
798 stars 224 forks source link

`faas-cli logs` has a different behaviour than `kubectl logs` or `docker logs` #683

Closed jonatasbaldin closed 4 years ago

jonatasbaldin commented 5 years ago

Expected Behaviour

When using faas-cli logs without any time flag, like --since, expect the same behaviour as kubectl logs or docker logs, which is to show all the logs.

Current Behaviour

The current behaviour of faas-cli logs in Kubernetes, without any time flag, is to output the latest 5 minutes of logs, as defined here.

Possible Solution

The solution is to define the default log output from faas-cli logs to all logs (when no time flag is used).

Steps to Reproduce (for bugs)

Using OpenFaaS with Kubernetes, do the following:

Context

As an new user to OpenFaaS and coming from K8S, I expect the same behaviour in the tooling – at least in some aspects. With logs, for example, I was really confused when kubectl logs was "working" but faas-cli logs "wasn't".

alexellis commented 5 years ago

Hi @jonatasbaldin

OpenFaaS is not Kubernetes, and whilst we try to maintain a common user-experience where we can. The OpenFaaS CLI works with multiple backends such as Swarm, AWS Lambda and Hashicorp Nomad.

There may also be other Kubernetes log providers such as ELK and Loki, which may again have different semantics.

With that in mind, I'll move this issue to the correct repo (openfaas/faas-cli) and ping the author of the feature @LucasRoesler for his input.

Alex

jonatasbaldin commented 5 years ago

Hey @alexellis, thanks for the answer :)

I understand that they are different tools and will probably have different experiences, it's just that I got a bit confused by the defaults, and maybe other users have as well.

Anyway, I would love the input from @LucasRoesler. If this proposal is suitable, I'd be keen to get involved in implementing it πŸ€“

Cheers 🍻

LucasRoesler commented 5 years ago

@alexellis and @jonatasbaldin I do not have an issue with changing the default. But... as Alex said, other systems have their own defaults, Loki defaults to 1hr ago. I can't find clear documentation on elasticsearch, but the Kibana UI uses 15 mins as the default.

It would be ideal to provide a consistent experience and have the clearly documented, to avoid surprises for users. Perhaps we can find out if/what the default experience in ELK is and then make a decision on a better default and then also clean up the docs. Even just finding and setting that default in the CLI will make it much clearer to users.

jonatasbaldin commented 5 years ago

ELK experience is the Kibana UI, isn't it? Or is there a different default that I should look for?

I think once we settle in a default I could update whatever is necessary (CLI, docs, faas-netes).

Would you like to keep the 5 minutes or change it?

LucasRoesler commented 5 years ago

I think ELK would be the Kibana UI, I believe it is 15 mins. But if someone has more experience with it and can confirm, that would be good.

I think the argument could be made for any of 5min, 15min, or 1hr and I think increasing the default makes sense. 15mins probably is a nice balance. @alexellis any feelings on this?

The easiest way to do this is to define a default in the CLI, so that It will then apply to all backends.

Jeff-Lowrey commented 4 years ago

Some quick comments -

  1. Kibana is actually the "K" in "ELK" - ELK stands for "ElasticSearch, Logstash, Kibana". It's a stack just like PLONK. Although I'm pretty sure people don't use Logstash anymore, they use Filestash or something else (I forget).
  2. The default time window that you see in Kibana when you open it up is 15 minutes - as you mentioned. By default, Discover shows data for the last 15 minutes
  3. It's also a GUI only tool - afaik - so there isn't a CLI that would let you ask for a view of it's data. That would have to be an ElasticSearch command.
  4. There isn't a standard CLI for ElasticSearch (AFAIK) that could give any input here. ElasticSearch is a time-series database.

So unless there are strong performance reasons or other, setting the default to 15 minutes is probably going to be familiar to a lot of admins.

alexellis commented 4 years ago

Closing as inactive. Thanks all for your comments.

alexellis commented 4 years ago

/lock