gpt4 book ai didi

amazon-web-services - aws cli 日志过滤模式排除

转载 作者:行者123 更新时间:2023-12-05 01:42:47 24 4
gpt4 key购买 nike

我正在尝试从 AWS 中运行的应用程序获取日志,同时排除包含特定短语的日志:

aws logs filter-log-events --log-group-name $MY_LOG_GROUP --filter-pattern -"dont want"

以上作品。但是,如果我改为尝试:

aws logs filter-log-events --log-group-name $MY_LOG_GROUP --filter-pattern -"dontwant"

我得到:

aws: error: argument --filter-pattern: expected one argument

我假设我的 shell 将其解析为附加标志,而不是 --filter-pattern 的参数。那么,第一个问题:如何强制 aws cli 将其视为参数?

如果我改为尝试:

aws logs filter-log-events --log-group-name "$MY_LOG_GROUP" --filter-pattern -"GET /healthcheck"

我得到:

An error occurred (InvalidParameterException) when calling the FilterLogEvents operation: Invalid filter pattern

第二个问题:这里有什么问题,我该如何解决?

最佳答案

试试这个:

aws logs filter-log-events --log-group-name $MY_LOG_GROUP --filter-pattern=-"dont want"

aws cli支持<option>=<value>语法也。看起来这是 awhile 的问题.

至于第二个例子,斜杠会导致问题,但我认为这是可行的,所以它不会尝试解释斜杠;也是 awhile 的问题:

aws logs filter-log-events --log-group-name "$MY_LOG_GROUP" --filter-pattern='-"GET /healthcheck"'

关于amazon-web-services - aws cli 日志过滤模式排除,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/50687406/

24 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com