按主机名过滤来自 google 个 http 负载均衡器的 stackdriver 日志
Filter stackdriver logs from google http loadbalancers by hostname
我想按主机名过滤 google http 负载均衡器上的请求。 http 负载均衡器生成可以搜索的 stackdriver 日志。我想我可以像这样搜索 httpRequest.requestUrl 的开头:
resource.type="http_load_balancer"
httpRequest.requestUrl=starts_with("https://example.com")
我认为在阅读 https://cloud.google.com/monitoring/api/v3/filters 后这会起作用。不幸的是这个 returns Invalid request: Non-Global functions are currently unsupported
我不介意是否必须对 http 和 https 执行单独搜索。
您正在查看的 URL 适用于 Stackdriver Monitoring。我假设您希望在 Stackdriver Logging 上对其进行过滤。
要在 Stackdriver Logging 上过滤 'http' 和 'https',请使用如下所示的高级过滤器。请注意,匹配 httpRequest.requestUrl 的运算符是冒号 :
,而不是等号 =
.
对于 HTTP
resource.type="http_load_balancer"
httpRequest.requestUrl:"http://example.com"
对于 HTTPS
resource.type="http_load_balancer"
httpRequest.requestUrl:"https://example.com"
请注意,这将在 整个字段 httpRequest.requestUrl 中搜索给定的字符串。从技术上讲这是错误的,但对于大多数主机名搜索来说它应该可以正常工作。
我想按主机名过滤 google http 负载均衡器上的请求。 http 负载均衡器生成可以搜索的 stackdriver 日志。我想我可以像这样搜索 httpRequest.requestUrl 的开头:
resource.type="http_load_balancer"
httpRequest.requestUrl=starts_with("https://example.com")
我认为在阅读 https://cloud.google.com/monitoring/api/v3/filters 后这会起作用。不幸的是这个 returns Invalid request: Non-Global functions are currently unsupported
我不介意是否必须对 http 和 https 执行单独搜索。
您正在查看的 URL 适用于 Stackdriver Monitoring。我假设您希望在 Stackdriver Logging 上对其进行过滤。
要在 Stackdriver Logging 上过滤 'http' 和 'https',请使用如下所示的高级过滤器。请注意,匹配 httpRequest.requestUrl 的运算符是冒号 :
,而不是等号 =
.
对于 HTTP
resource.type="http_load_balancer"
httpRequest.requestUrl:"http://example.com"
对于 HTTPS
resource.type="http_load_balancer"
httpRequest.requestUrl:"https://example.com"
请注意,这将在 整个字段 httpRequest.requestUrl 中搜索给定的字符串。从技术上讲这是错误的,但对于大多数主机名搜索来说它应该可以正常工作。