Azure AKS内部日志到Azure Logs/Azure Sentinel
是否有一种动态方法可以从内部我的容器中获取日志数据?
我的所有搜索都在返回,即Azure Logs/Azure Sentinel可以读取有关AKS相对于容器中存在的数据(在线,运行,失败等)的数据,但实际上不是实际的内部内日志。结果的示例询问:
- https ://learn.microsoft.com/en-us/azure/azure-monitor/containers/container-insights-log-query
- https://learn.microsoft.com/en-us/azure/azure-monitor/containers/container-insights- livedata-overview
- https://github.com/microsoftdocs/azure-docs/azure-docs/blob/blob/blob/main/main/articles/articles/azure-monitor /containers/container-ingights-enable-new-cluster.md#enable-monitoring of-a-new-azure-kubernetes-kubernetes-kubernetes-service-aks-cluster
...所有这些都提供了有关监视容器的文档(当它们居住在K8S中时),而不是容器中的应用程序级日志...
是否有人知道Azure Logs/Azure Sentinel的技术或能力,可以在容器中消耗式固定器,盘中容器日志(例如,容器内: /var/log,/var/application/log等)?
谢谢!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
假设您指的是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 askubectl logs <pod>
. Anything that's sent tostdout
andstderr
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 tostdout
.Here's how I'm able to get SMTP logs from my container:
好的,所以我忘记了这个问题,但只是要发布答案。我有点使用了@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:
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.