Azure AKS内部日志到Azure Logs/Azure Sentinel

发布于 2025-01-23 17:42:02 字数 1515 浏览 5 评论 0 原文

是否有一种动态方法可以从内部我的容器中获取日志数据?

我的所有搜索都在返回,即Azure Logs/Azure Sentinel可以读取有关AKS相对于容器中存在的数据(在线,运行,失败等)的数据,但实际上不是实际的内部内日志。结果的示例询问:

...所有这些都提供了有关监视容器的文档(当它们居住在K8S中时),而不是容器中的应用程序级日志...

是否有人知道Azure Logs/Azure Sentinel的技术或能力,可以在容器中消耗式固定器,盘中容器日志(例如,容器内: /var/log,/var/application/log等)?

谢谢!

Is there an dynamic way to pull log data from inside my containers?

All of my searches are returning that Azure Logs/Azure Sentinel can read data about AKS relative to the containers as they exist in K8s (online, running, failed, etc.) but not the actual in-container logs. Examples of results asking for this:

...all of these provide documentation on monitoring containers (as they live in K8s) but not the app-level logs in the containers...

Is anyone aware of a technology or capability for Azure Logs/Azure Sentinel to consume in-container, on-disk container logs (e.g. inside the container: /var/log, /var/application/logs, etc.)?

Thanks!

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

游魂 2025-01-30 17:42:02

假设您指的是Linux容器。您只需要启用OMS代理并指向正确的工作区,这可以使日志轻松流过。

containerLog 表,将向您显示与 kubectl logs< pod> 相同的东西。任何发送到 stdout stderr 的所有内容都应在日志分析工作区中可用。因此,如果这些都没有发送到任何一个,您可以将小脚本作为容器的一部分编写,它将这些日志发送到 stdout

这就是我能够从容器中获取SMTP日志的方式:

Assuming you're referring to linux containers. You only need to have have the OMS agent enabled and pointing to the right workspace and this gets the logs streamed over easily.

The ContainerLog table which would show you the same thing as kubectl logs <pod>. Anything that's sent to stdout and stderr from your container should be available in the Log Analytics Workspace. So if these are not being sent to either, you could just write a small script as part of your container, that would send those logs to stdout.

Here's how I'm able to get SMTP logs from my container:

enter image description here

灵芸 2025-01-30 17:42:02

好的,所以我忘记了这个问题,但只是要发布答案。我有点使用了@KedMardeMootoo建议的内容,我们在其中使用来自容器的标准日志输出来读取文件。

但是,主要区别是我使用K8S Sidecar模式监视我的容器中的日志文件,以便我可以专门对特定日志文件进行 kubectl logs 输出。

清单变化看起来像:

”在此处输入图像描述”

当我们使用BusyBox图像时,Alpine也可以正常工作。这个想法是它是一个很小的OS映像,因此您不会爆炸您的Worker节点处理器/内存利用率,但是ECHO是特定的日志输出到STDOUT,因此可以通过Azure Log Analytics(AZA)捕获它。使用 tiny linux OS,该操作系统只需尾随特定的日志文件(带有反映正在尾随的日志文件的容器名称),并且它将显示在Aza中该容器的日志条目下。

仅供参考 - Busybox和Alpine就像3-5MB大小的容器图像。

Ok so I'd forgotten about this question but just to post an answer. I kinda used what @kedmardemootoo suggested, where we use the standard log output from a container to read the file.

however, the main difference is I used the K8s sidecar pattern to monitor log files in my container so that I could do a kubectl logs output exclusively to a particular log file.

The manifest changes looks like:

enter image description here

while we're using a BusyBox image, Alpine would also work fine. The idea is that it's a tiny OS image so you don't explode your worker node processor/memory utilization but echo's a particular log's output to STDOUT so it can be captured by Azure Log Analytics (AZA). Use a tiny linux OS that just tails a particular log file (with a container name that reflects the log file being tail'd) and it will show up under that container's log entries in AZA.

FYI -- BusyBox and Alpine are like 3-5MB sized container images.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文