Comments (13)
From @estesp (containerd maintainer):
...this might help.. you could even track this back to a higher level as there is a CRI command to get logs (e.g. crictl logs ..) that I assume ends up being implemented by this feature of attaching writers to the containerd container IO impl. https://github.com/containerd/cri/blob/c23ed3befc08b3b85ea3fb50c6c99330871e9295/pkg/server/io/container_io.go#L204
There is also a logger impl in that same package that is how the CRI plugin actually writes out to log files, which could be done in your client as well: https://github.com/containerd/cri/blob/c23ed3befc08b3b85ea3fb50c6c99330871e9295/pkg/server/io/logger.go
from faasd.
CRI appears to store logs on disk: https://www.youtube.com/watch?v=cudJotS97zE
from faasd.
from faasd.
Here's an example of using the CRI logging code to write to a file, from a ping process started outside of a container. It should be possible to hook it up to the container from containerd.
https://gist.github.com/alexellis/f232fe1fd2fe5278d411732af2645d79
The issue I see is that if faasd restarts, we'll lose the logs of the process since the io/copy is done in the parent.
At a guess (I may be wrong) - we need to fork a separate long-running process after starting the container to copy the log streams, or have that process start the container. This feels like a lot of indirection and "janky". I would like to get more input from those in the know.
Is this ☝️ something that containerd can do via options and manage in its daemon?
The lifecycle for cri's log handling isn't entirely clear - https://github.com/containerd/cri/blob/9d60f9c56ea34166660e89c0a811e2869e0dcfeb/pkg/server/container_start.go#L86 (this is part of a package called "server")
from faasd.
K8s logging architecture - https://kubernetes.io/docs/concepts/cluster-administration/logging/#logging-at-the-node-level "Everything a containerized application writes to stdout and stderr is handled and redirected somewhere by a container engine" 🤔
from faasd.
Further example (albeit an old one) from @crosbymichael - containerd/containerd#3085
from faasd.
If you kill faasd from command using
sudo ps aux | grep -i faas | awk '{print $2}' | sudo xargs kill -9
you will see the containers are still running using the command
sudo ./ctr tasks ls
following is what I see on my machine (Linux Ubuntu 19.04)
TASK PID STATUS
gateway 3032 RUNNING
queue-worker 3222 RUNNING
basic-auth-plugin 2620 RUNNING
nats 2728 STOPPED
prometheus 2850 RUNNING
only the nats container is stopped while the rest is running.
Using the command
sudo ./ctr tasks attach gateway
able to attach to the container 'gateway' and the log is streamed.
Is this the behaviour you looking for ?
from faasd.
We have logs now via #50 - they are recorded via the systemd journal, but not queried back via the API.
This package may be of help/use:
from faasd.
This issue is about implementing the logs handler for log retrieval (pending) and also for log recording (that part is completed now) cc @LucasRoesler as mentioned on Slack https://openfaas.slack.com/archives/C1D32GFS8/p1582487994062300
from faasd.
I would like to avoid any dependency on CGO as this will create issues when deploying to different OSes. sdjournal seems to take a hard dependency on it.
from faasd.
Orbit by @ehazlett execs journalctl
, that may be the reason why.
https://github.com/stellarproject/orbit/blob/45483b663600e92c8de516a127c0ed13ec5268be/cmd/ob/log.go
from faasd.
Does that mean that exec is ok then?
from faasd.
We used exec here, thank you @LucasRoesler for your work on the feature. Closing the issue.
from faasd.
Related Issues (20)
- Error pulling private image from GitHub Container Registry HOT 5
- [Debug help] Function respond 200 but client receive 500 HOT 3
- Is Scale to Zero included in faasd? HOT 2
- Queue Worker stops to work HOT 1
- faas-cli logs not showing anything HOT 1
- Remove basic auth plugin HOT 3
- Inter-function Communication Feature Asking HOT 5
- Support request for faasd and Go HOT 4
- Update to containerd 1.7.0 - last release with 32-bit Arm support
- Support request logging in HOT 2
- Issues with rust HOT 1
- Access host's network from a docker-compose.yaml's service HOT 5
- Support request for Docker installed with faasd (invalid) HOT 5
- Can docker-compose be used with faasd? HOT 8
- Support question on MQTT HOT 4
- Executing install.sh fails because of wrong version HOT 1
- Grafana installation - volume permissions HOT 2
- Multi-node support HOT 3
- Support request for monitoring with cAdvisor HOT 6
- NATS JetStream support HOT 2
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from faasd.