我希望处理所有日志文件以将Gitlab-ci Job标记为成功后,logstash以代码0退出 [英] I want logstash to exit with a code 0 after processing all log files to mark Gitlab-ci Job as successful

查看:72
本文介绍了我希望处理所有日志文件以将Gitlab-ci Job标记为成功后,logstash以代码0退出的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试配置一个Gitlab-ci作业,该作业从生产服务器收集日志,并通过使用Logstash泊坞窗映像的作业将其发送到ElasticSearch服务器.

I'm trying to configure a Gitlab-ci Job that collects logs from production servers and sends them to an elasticSearch server via a job that uses the Logstash docker image.

我知道这不是通常的方法,但是我们不允许在这些服务器上安装Logstash!

I know this is not the usual method, but we are not allowed to install Logstash on these servers!

该作业运行良好,但是问题在于,一旦文件处理完成,我们就无法为Logstash指定参数以代码0退出.

The Job works well, but the problem is that we don't have the ability to specify a parameter to Logstash to exit with code 0 once the file processing is finished.

Gitlab-ci作业始终处于运行状态,并在达到最大执行时间时停止并显示错误代码.即使在Elasticsearch中对日志进行了良好索引,该管道也被标记为失败!

Gitlab-ci Job is therefore always running and stops with an error code when the maximum execution time is reached. The pipeline is marked as having failed even if the logs are well indexed in Elasticsearch!

有什么办法解决或绕过这种情况吗?

Any idea how to solve or bypass this situation ?

下面是运行Logstash的Gitlab-ci作业

Below is the Gitlab-ci job that runs Logstash

Job:Process:
  stage: process
  image: logstash:6.5.4
  dependencies:
    - Job:Getlogs
  script:
    - logstash -f config/logstash.conf

在此先感谢您,感谢我的英语翻译!

Thank you in advance and sorry for my English translation!

推荐答案

我在其他地方看到的一个技巧是将日志发送到logstash中,并使用 stdin 输入来处理它们.

A trick I've seen elsewhere is to pipe your logs into logstash, and use the stdin input to process them.

 cat /var/log/my_log | logstash -f my_config

这篇关于我希望处理所有日志文件以将Gitlab-ci Job标记为成功后,logstash以代码0退出的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆