在 JMESpath 中查找 X 和 Y 之间的所有值
Find all values between X and Y in JMESpath
我正在尝试在 AWS cli 中查询 aws logs
。
我试过的查询 aws logs describe-log-streams --log-group-name /aws/batch/job --region us-west-1 --order-by LastEventTime
我收到的回复是这样开头的:
{
"logStreams":[
{
"logStreamName":"Name-With-Identifier",
"creationTime":1549558015102,
"firstEventTimestamp":1549558015498,
"lastEventTimestamp":1549558028386,
"lastIngestionTime":1549558028565,
"uploadSequenceToken":"49590579609731080948197832029410897711804458425099756082",
"arn":"arn:aws...",
"storedBytes":2311
},
{
"logStreamName":"Name-With-Identifier",
"creationTime":1549558037404,
"firstEventTimestamp":1549558037788,
"lastEventTimestamp":1549558054875,
"lastIngestionTime":1549558055107,
"uploadSequenceToken":"49588831790141890077331969472298852407397478833047221858",
"arn":"arn:aws...",
"storedBytes":12702
},
{
"logStreamName":"Name-With-Identifier",
"creationTime":1566839792673,
"firstEventTimestamp":1566839793320,
"lastEventTimestamp":1566839793964,
"lastIngestionTime":1566839931587,
"uploadSequenceToken":"49595380751905665182286741430582817999725054738015728770",
"arn":"arn:aws...",
"storedBytes":0
}
]
}
我只对 firstEventTimestamp
介于 1566594000 和 1566853200 之间的日志感兴趣。
有没有办法做到这一点,如果有的话怎么做?
我在 http://jmespath.org/tutorial.html.
找不到答案
顺便说一句,请忽略时间差异,这可以解决(自动或通过 --starting-token
选项)。
如果您不使用动态值,而只想要 1566594000 和 1566853200 之间的日志,则请求如下:
logStreams[?firstEventTimestamp >= `1566594000` && firstEventTimestamp <= `1566853200`]
我正在尝试在 AWS cli 中查询 aws logs
。
我试过的查询 aws logs describe-log-streams --log-group-name /aws/batch/job --region us-west-1 --order-by LastEventTime
我收到的回复是这样开头的:
{
"logStreams":[
{
"logStreamName":"Name-With-Identifier",
"creationTime":1549558015102,
"firstEventTimestamp":1549558015498,
"lastEventTimestamp":1549558028386,
"lastIngestionTime":1549558028565,
"uploadSequenceToken":"49590579609731080948197832029410897711804458425099756082",
"arn":"arn:aws...",
"storedBytes":2311
},
{
"logStreamName":"Name-With-Identifier",
"creationTime":1549558037404,
"firstEventTimestamp":1549558037788,
"lastEventTimestamp":1549558054875,
"lastIngestionTime":1549558055107,
"uploadSequenceToken":"49588831790141890077331969472298852407397478833047221858",
"arn":"arn:aws...",
"storedBytes":12702
},
{
"logStreamName":"Name-With-Identifier",
"creationTime":1566839792673,
"firstEventTimestamp":1566839793320,
"lastEventTimestamp":1566839793964,
"lastIngestionTime":1566839931587,
"uploadSequenceToken":"49595380751905665182286741430582817999725054738015728770",
"arn":"arn:aws...",
"storedBytes":0
}
]
}
我只对 firstEventTimestamp
介于 1566594000 和 1566853200 之间的日志感兴趣。
有没有办法做到这一点,如果有的话怎么做?
我在 http://jmespath.org/tutorial.html.
顺便说一句,请忽略时间差异,这可以解决(自动或通过 --starting-token
选项)。
如果您不使用动态值,而只想要 1566594000 和 1566853200 之间的日志,则请求如下:
logStreams[?firstEventTimestamp >= `1566594000` && firstEventTimestamp <= `1566853200`]