使用堆栈驱动器CLI查找时间戳之间的日志 [英] Find logs between timestamps using stackdriver CLI
问题描述
我需要使用stackdriver CLI查找两个时间戳之间的日志.我用下面的命令.
I need to find logs between two timestamps using stackdriver CLI. I used the below command.
gcloud beta logging read "timestamp>=\"2017-02-19T00:00:00Z\" AND timestamp<\"2017-03-14T00:00:00Z\""
但是它给了我错误:
文件名,目录名称或卷标签语法不正确.
这是我的gcloud版本详细信息
Here is my gcloud version details
推荐答案
我是具有Stackdriver Logging的产品经理.我们已经测试了该命令,它似乎可以正常工作.问题可能出在Windows命令外壳程序上?一种猜测是也许>"和<"需要在前面加上"/"吗?将查询复制并粘贴到Cloud Shell中可以正常工作.
I'm a product manager with Stackdriver logging. We've tested the command and it seemed to work fine. The issue may be with Windows command shell? One guess is that perhaps the ">" and "<" need "/" in front? Copying and pasting your query into cloud shell works fine.
向一位推荐此建议的Google工程师致以敬意: 我在Windows上使用gcloud --filter命令遇到了很多问题.以下作品:
Kudos go to a Google engineer who recommended this: I came across this issue a lot with gcloud --filter commands on windows. The following works:
gcloud beta logging read "timestamp^>=""2017-02-19T00:00:00Z"" AND ""timestamp^<2017-03-14T00:00:00Z"""
请注意使用双"和^转义字符.
Note use of double "" and ^ escape characters.
您可以在命令行中添加--verbosity debug,它将向您展示gcloud如何准确地理解参数.
You can add --verbosity debug to the command line, it will show you how exactly parameters were understood by gcloud.
这篇关于使用堆栈驱动器CLI查找时间戳之间的日志的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!