简体   繁体   English

应用程序日志文件到 ELK

[英]Application log files to ELK

We have application deployed in K8S pod and all logs are being monitored in ELK stack.我们在 K8S pod 中部署了应用程序,并且所有日志都在 ELK 堆栈中进行监控。 Now we have one application which is using external *.jar which is writing logs in one file local to container path.现在我们有一个使用外部 *.jar 的应用程序,它将日志写入容器路径本地的一个文件中。 How I can send this logs to kubernetes console so that it will come to elastic search monitoring.如何将此日志发送到 kubernetes 控制台,以便将其用于弹性搜索监控。

Any help is much appreciated..任何帮助深表感谢..

Now we have one application which is using external *.jar which is writing logs in one file local to container path.现在我们有一个使用外部 *.jar 的应用程序,它将日志写入容器路径本地的一个文件中。 How I can send this logs to kubernetes console so that it will come to elastic search monitoring.如何将此日志发送到 kubernetes 控制台,以便将其用于弹性搜索监控。

There are three ways, in increasing order of complexity:有三种方式,按照复杂度递增的顺序:

  1. Cheat and symlink the path it tries to log to as /dev/stdout (or /proc/1/fd/0 );将它尝试登录的路径作弊并将其符号链接为/dev/stdout (或/proc/1/fd/0 ); sometimes it works and it's super cheap, but if the logging system tries to seek to the end of the file, or rotate it, or catches on that it's not actually a "file", then you'll have to try other tricks有时它可以工作并且非常便宜,但是如果日志系统试图寻找文件的末尾,或者旋转它,或者发现它实际上不是一个“文件”,那么你将不得不尝试其他技巧
  2. If the app uses a "normal" logging framework, such as log4j, slf4j, logback, etc, you have a better-than-average chance of being able to influence the app's logging behavior via some well placed configuration files or in some cases environment variables如果应用程序使用“普通”日志记录框架,例如 log4j、slf4j、logback 等,则通过一些放置良好的配置文件或在某些情况下环境影响应用程序的日志记录行为的机会高于平均水平变量
  3. Actually, you know, ask your developers to configure their application according to the 12 Factor App principles and log to stdout (and stderr!) like a sane app实际上,您知道,请您的开发人员根据12 Factor App原则配置他们的应用程序,并像理智的应用程序一样登录到标准输出(和标准错误!)

Without more specifics we can't offer more specific advice, but that's the gist of it没有更多细节,我们无法提供更具体的建议,但这就是要点

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 带有Elk堆栈的Docker容器可浏览Nginx和tomcat日志文件 - Docker container with Elk stack to browse nginx and tomcat log files Docker:将写入容器内的日志文件发送到 ELK 堆栈 - Docker: Ship log files being written inside containers to ELK stack 如何从 dockerised ELK 中清除日志文件? - How do I clean log files from dockerised ELK? 如何在 elk filebeat 中限制 *-json.log - How to limit *-json.log in elk filebeat Docker容器无法将日志发送到Docker ELK堆栈 - Docker container cannot send log to docker ELK stack Docker容器应用程序记录到ELK堆栈而没有文件拍子 - Docker container Application logs to ELK stack without filebeat 用于读取远程 VM 上的 docker 容器化应用程序日志文件的 shellscript 不起作用 - shellscript to read log files of a docker containerised application on a remote VM is not working 将Docker容器中的多个日志文件重定向到stdout(旧版应用程序) - Redirect several log files in docker container to stdout (legacy application) 如何使用syslog将日志发送到elk时保存linux服务器中的日志文件 - How save log file in linux sever while sending logs to elk using syslog 我应该在哪里存储在Container(docker / kubernetes)中运行的应用程序的日志文件? - Where should I store log files of an application running in Container(docker/kubernetes)?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM