I have a similar situation, trying to filter from a generic channel created to avoid hundreds of channels and only filtering through projects that are of interest.
I'm trying to use JSON path, however haven't been able to get the filter to work properly.
REST API Response:
{
"executionTime": {
"millis": 176,
"seconds": 0
},
"returnCode": 0,
"root": [
{
"active": "true",
"addStatisticsCodeEnabled": "false",
"applicationBundleName": null,
"applicationFeatureURL": null,
"applicationGroup": null,
"applicationId": "_etKaMNi2EeiDS5lpQcx7fA",
"applicationName": "Corrected_TestContextVar",
"applicationType": "JOB",
"applicationVersion": "0.3",
"applyContextToChildren": "false",
"artifactGroupId": "org.example.testcontextvariable.job",
"artifactId": "Corrected_TestContextVar",
"artifactVersion": "0.4.0-LATEST",
"awaitingExecutions": "0",
"branch": "trunk",
"commandLineVersion": "7.0.1.20180411_1414",
"concurrentExecution": "false",
"contextName": "DEV",
"description": null,
"errorStatus": "NO_ERROR",
"execStatisticsEnabled": "false",
"executionServerId": "JOB_SERVER_3",
"featuresName": null,
"featuresVersion": "0.4.0-LATEST",
"framework": "",
"frozenExecutions": "0",
"id": "32",
"idQuartzJob": "32",
"jobServerLabelHost": "qav1-tj1",
"jobscriptarchivefilename": "1540772209274_task_32.zip",
"label": "asdf",
"lastDeploymentDate": "2018-10-28 20:17:05.0",
"lastEndedRunDate": "2018-10-28 20:17:12.0",
"lastRunDate": "2018-10-28 20:17:10.0",
"lastScriptGenerationDate": "2018-10-28 08:56:54.0",
"lastTaskTraceError": "",
"latestVersion": "false",
"log4jLevel": "Info",
"nextFireDate": null,
"onUnknownStateJob": "WAIT",
"onlineStatus": null,
"originType": "ZIP",
"pid": null,
"processingState": "false",
"projectId": "10",
"projectName": "TESTCONTEXTVARIABLE",
"regenerateJobOnChange": "false",
"remaingTimeForNextFire": null,
"repositoryName": "qa_releases",
"runAsUser": null,
"snapshot": "false",
"status": "READY_TO_RUN",
"svnConnectionAvailable": null,
"svnRevision": null,
"taskType": "ARTIFACT_TASK",
"timeOut": null,
"triggersStatus": "NO_TRIGGER",
"uniqueId": "bcd301d8-cdd2-43c1-b020-1be08f884b51",
"virtualServerLabel": null
},
{
"active": "true",
"addStatisticsCodeEnabled": "true",
"applicationBundleName": null,
"applicationFeatureURL": null,
"applicationGroup": null,
"applicationId": "_etKaMNi2EeiDS5lpQcx7fA",
"applicationName": "Corrected_TestContextVar",
"applicationType": "JOB",
"applicationVersion": "0.3",
"applyContextToChildren": "false",
"artifactGroupId": "org.example.testcontextvariable.job",
"artifactId": "Corrected_TestContextVar",
"artifactVersion": "0.4.6-LATEST",
"awaitingExecutions": "0",
"branch": "trunk",
"commandLineVersion": "7.0.1.20180411_1414",
"concurrentExecution": "false",
"contextName": "QA",
"description": "Testing with different context variables",
"errorStatus": "NO_ERROR",
"execStatisticsEnabled": "false",
"executionServerId": "JOB_SERVER_3",
"featuresName": null,
"featuresVersion": "0.4.6-LATEST",
"framework": "",
"frozenExecutions": "0",
"id": "33",
"idQuartzJob": "33",
"jobServerLabelHost": "qav1-tj1",
"jobscriptarchivefilename": "1540785329196_task_33.zip",
"label": "Context Variable Testing",
"lastDeploymentDate": "2018-10-28 23:55:31.0",
"lastEndedRunDate": "2018-10-28 23:55:32.0",
"lastRunDate": "2018-10-28 23:55:31.0",
"lastScriptGenerationDate": "2018-10-29 00:09:28.0",
"lastTaskTraceError": "",
"latestVersion": "false",
"log4jLevel": "Info",
"nextFireDate": null,
"onUnknownStateJob": "WAIT",
"onlineStatus": null,
"originType": "ZIP",
"pid": null,
"processingState": "false",
"projectId": "10",
"projectName": "TESTCONTEXTVARIABLE",
"regenerateJobOnChange": "false",
"remaingTimeForNextFire": null,
"repositoryName": "qa_releases",
"runAsUser": null,
"snapshot": "false",
"status": "READY_TO_RUN",
"svnConnectionAvailable": null,
"svnRevision": null,
"taskType": "ARTIFACT_TASK",
"timeOut": "3600",
"triggersStatus": "NO_TRIGGER",
"uniqueId": "fb6798f6-6129-42c1-b641-c616d3d30e85",
"virtualServerLabel": null
}
]
}
This is my Generic Channel creation that works:
{
"prtg": {
"result": [
{
"value": {
"["+ #1 +"]" + " Error Status": $..({@.label : lookup(@.errorStatus, "KILLED")}).*
}
}
]
}
}
This is the filter I'm trying to create and haven't had success yet:
{
"prtg": {
"result": [
{
"value": {
"["+ #1 +"]" + " Error Status": $.[[email protected]=="TESTCONTEXTVARIABLE"].({@.label : lookup(@.errorStatus, "KILLED","JOB_ERROR","NO_ERROR")}).*
}
}
]
}
}
Error Message:
Parsing error: { "prtg": { "result": [ { "value": { "["+ #1 +"]" + " Error Status": $.[[email protected]=="TESTCONTEXTVARIABLE"].({@.label : lookup(@.errorStatus, "KILLED","JOB_ERROR","NO_ERROR")}).* } } ] } } }:6:38 - 6:39 unexpected "[" while scanning JSON select expected Ident, "." or "*".
Any ideas on how to get this filter to work? Also, is there anyway to have wildcards in the filters or regular expressions?
Looking for something similar to: projectName LIKE *Core*Ingestion
Which would match:
"projectName": "nCore_Job_Ingestion"
"projectName": "tCore_restore_Ingestion"
Thanks
Gui Lopes
Add comment