import logql.parser.LogQueryParser
val res1 = LogQueryParser.parse("""{label1="val"}""")
//res1: Right(LogQueryExpr(List(MatchEqual(label1,val)),List()))
val res2 = LogQueryParser.parse("""{label1="val", label2 =~ "v.*"} |= "plaintext" | (age = 10 and num > 10) or num2 <= 101s """)
/*
res2: Right(
LogQueryExpr(
List(
MatchEqual("label1", "val"),
MatchRegexp("label2", "v.*"),
),
List(
LineFilterExpr(ContainsString, "plaintext"),
ConditionExpr(
OrCondition(
AndCondition(
CompareCondition(AST.Equal, "age", NumberValue(10)),
CompareCondition(AST.GreaterThan, "num", NumberValue(10.0))
),
CompareCondition(AST.LessEqual, "num2", DurationValue(101, TimeUnit.SECONDS))
)
)
)
)
)
*/
-
Notifications
You must be signed in to change notification settings - Fork 0
alirezameskin/logql-parser
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|