简体   繁体   English

我们可以为 Rundeck 中的项目提供日志目录吗?

[英]Can we provide a logging directory for a project in Rundeck?

I have several projects with multiple cron jobs scheduled in each on a Linux machine configured with Rundeck.我在配置了 Rundeck 的 Linux 机器上有多个项目,每个项目都安排了多个 cron 作业。 I wanted to know if there is a simpler logging configuration that could be added so that all logs belonging to crons of one project are available in a common directory.我想知道是否可以添加更简单的日志记录配置,以便属于一个项目的 cron 的所有日志都可以在公共目录中使用。
For instance, project A contains 3 scheduled crons A1, A2 and A3.例如,项目 A 包含 3 个计划的 cron A1、A2 和 A3。 A possibility of logging in a common directory would be to do add the log location to the cron command individually登录公共目录的可能性是将日志位置单独添加到 cron 命令

bash testA1.sh>/logs/A/logA1.log
bash testA2.sh>/logs/A/logA2.log
bash testA3.sh>/logs/A/logA3.log

I wanted to know if there is a configuration for the project level A where I could add the parent directory for logging as /logs/A I could then change the commands as我想知道是否有项目级别A的配置,我可以在其中添加父目录以将日志记录为/logs/A然后我可以将命令更改为

bash testA1.sh>logA1.log
bash testA2.sh>logA2.log
bash testA3.sh>logA3.log

Additionally, can the logging file be provided in the cron configuration without specifying >{log_file_name}.log in the command.此外,是否可以在 cron 配置中提供日志文件,而无需在命令中指定>{log_file_name}.log

Using logging plugin you can do that.使用日志插件你可以做到这一点。

For example, you can configure a log plugin (for example s3/minio plugin ) at project level (setting at project.properties file)-例如,您可以在项目级别配置日志插件(例如s3/minio 插件)(在 project.properties 文件中设置)-

project.plugin.ExecutionFileStorage.org.rundeck.amazon-s3.path=/common/path/logs/${job.project}/${job.execid}.log

As you see, you can use job/project context variables with your custom path/filenames.如您所见,您可以将作业/项目上下文变量与您的自定义路径/文件名一起使用。

Check the full configuration documentation. 检查完整的配置文档。

Tip: you can use s3 log plugin with Minio locally without problems.提示:您可以在本地使用Minio 的s3 日志插件而不会出现问题。

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

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM