我试图从子查询中访问一个变量(在本例中是sampleFromDate和sampleToDate)。我已经用语法eval variableName = value定义了变量,并希望使用语法filterName=$variableName$进行访问。参见下面的示例,其中我试图使用earliest=$sampleFromDate$ latest=$sampleToDate$访问值
index=*
earliest=-8d latest=-1d
| eval sampleToDate=now()
| eval sampleFromDate=relative_time(now(), "-1d")
| appendcols [
search (index=*)
earliest=$sampleFromDate$ latest=$sampleToDate$
] 这会产生错误:
无效值"$sampleFromDate$“表示时间术语‘最早’
sampleFromDate的值为自时代时间以来的秒格式。
1612251236.000000
我知道我可以做earliest=-d latest=now(),但是我不想这样做,因为我想在几个位置引用变量并在最后输出它们。
发布于 2021-02-03 17:03:53
为什么要尝试eval这些时间值?
只要做:
index=* earliest=-8d latest=-1d
| <rest of search>
| appendcols [
search (index=*) earliest=-1d
| <rest of appended search>
] 没有必要显式地设置latest,除非您想要now()以外的其他东西
https://stackoverflow.com/questions/66023059
复制相似问题