-
Notifications
You must be signed in to change notification settings - Fork 1.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
How to send knative logs via TCP? #15745
Comments
Parsing happens here I'd honestly use fluentbit or something - I doubt anyone's done this before and I don't think we'd support this if you have problems. eg. what happens to latency in the activator when logging over the URL is slow. |
Thanks for the reply, I'll look into fluentbit setup since looks like I have no other choice. In regards to the following:
Is there something like async TCP appender for zap? (something similar to the config I mentioned for logback) |
If you dive deeper (I added some logging here):
the error is this:
b) "outputPaths": ["http://logging-agent-svc-main:5170"]
You need a custom async sink it seems as in here which you will have to register e.g. RegisterHTTPSink("http", "http://logging-agent-svc-main:5170") before you parse the configuration. However, as @dprotaso mentioned probably it is easier to handle this via parsing logs with some tooling (especially if it is already there for other purposes). |
Going to close this out as there isn't anything actionable here |
Okay, let's forget about async/TCP/etc. How do I configure Knative with something else (fluentbit?) to collect Knative logs into OpenSearch or send them to Kafka? (Kafka - to enrich and send logs to OpenSearch) I read the docs on logging, however it looks like a configuration for apps running on Knative - not for Knative itself. (documentation suggests to configure logging namespace with fluentbit which listents on HTTP port) |
fluentbit captures logs for all pods - that should include the knative control plane as well I'd honestly look at the fluentbit docs here - https://docs.fluentbit.io/manual - what we have on that page is using a real old fluenbit verison |
Thanks for the answers! I have a very related question, so I will post it here. Please let me know if you prefer it to be a separate issue and I'll move it. How to send Knative logs to a file instead of stdout/stderr? Again, I tried to update
But the logging config is not applied and I only get the following warn message in knative pod logs on the start: {
"severity": "WARNING",
"timestamp": "2025-02-17T11:27:49.692552735Z",
"logger": "fallback-logger",
"caller": "logging/config.go:73",
"message": "Failed to parse logging config - using default zap production config",
"commit": "6a27004"
} No other info about the reason is logged. So, it would be nice
|
we're just parsing json into a zap.Config - you can run a small go app locally to confirm the exact error https://github.com/knative/pkg/blob/5be486852d2713f8204aad8707e80da0004b6a5e/logging/config.go#L125
I'd say our answer is similar to TCP - we don't support this
Feel free to update the code here |
Okay, I finally found how to make knative pods log into a file. The problem was with write permissions for a knative container. I added shared volume for logging, e.g. volumes:
- name: shared-volume
emptyDir: { }
containers:
- name: controller
volumeMounts:
- name: shared-volume
mountPath: /logs and added log file in the
|
Hi, I'm looking for a way to send logs produced by knative pods to OpenSearch.
We have a standard way of doing this for our applications running in k8s:
app --[sends logs via TCP Socket Appender to]--> logging-agent --[sends to]--> Kafka --> validator/enricher --> OpenSearch
So, ideally I want to use the same mechanism for knative, with no new components installed in the k8s cluster (fluentbit, sidecars, etc).
The app logging configuration uses logback and looks like this (logging to
logging-agent-svc-main:5170
usingLogstashTcpSocketAppender
):And now I want the same thing for knative pods, but I cannot figure out how to configure it. I read the docs on logging and tried to update
config-logging
ConfigMap, i.e. addingdata.zap-logger-config
field:I looked at the zap documentation and tried to set
outputPaths
with one of the following:"outputPaths": ["logging-agent-svc-main:5170"]
"outputPaths": ["http://logging-agent-svc-main:5170"]
However, it does not work and I can see the warning message in a knative pod (e.g., controller) during the start:
Could you suggest the way this can be done, please?
The text was updated successfully, but these errors were encountered: