I have a CloudFormation dashboard where I link/reference alarms using Alarm Annotations.
The names/ARNs of these alarms differ based on a condition. I want to a include a simple condition using the Fn::If intrinsic condition as below:
I have tried the following:
"properties": {
"annotations": {
"alarms": [
{'Fn::If': ["<condition>", "<value_if_true>", "<value_if_false>"]}
]
}
}
This gives me an error. I want to include a simple if condition.
Is there something that I am missing?
Based on the commends, the issue reported was caused by the use of single quotes in 'Fn::If'.
The solution was to use double quotes, as single quotes are not json complient: "Fn::If".
Related
Is it possible to use wild card in Kibana visualize search bar.
Tried to use it like below, but did not work.
operation: "Revers" NOT file:"*Test.Revers"
This returns 2 because there are two Revers terms ("Revers", "/test/count/Test.Revers" ) even though only one data entry is in the stats data.
The following also returns the same value as 2.
operation: "Revers"
Stat data sample is as below.
"_source": {
"status": 0,
"trstime": 1819,
"username": "test",
"operation": "Revers",
"file": "/test/count/Test.Revers"
}
I have tested it in ES 7.10 as you not mentioned ES version.
Answer to your question is YES, you can use wildcrad in Kibana visualize search bar but value should be without double quotes. Because if you give value in doble quotes it will consider as text and search for it.
You can try below query and it will give you your expected output:
operation: Revers AND NOT file.keyword: *Test.Revers
The result given for the below query as 1 without double quotes.
operation: Revers AND NOT file: *Test.Revers
In just starting to use JMeter I am trying to set variables of the form taskId_1, taskId_2, taskId_3 (defined in "User Defined Variables") and use them in HTTP Samples (REST requests). When I run postprocessors none of my JSON Extractors or Regular Expression Extractors save the values matched (and I tested the extracted regular expression using RegExp tester.)
The response sent from the GET request that I am parsing looks like (edited for readability):
{
"case-data": {
"Description": "100 parallel tasks",
"Workflow": {
"com.MyCompany": {
"workflow-case-id": null,
"stages": [
{
"stage-guid": "470D2E00-A9E1-11EB-887B-4226FC2CA371",
"tasks": [
{
"task-name": "Stage1Task1P",
"user-group-id": "Joe",
"task-id" : 52
},
{
"task-name": "Stage1Task2P",
"user-group-id": "Joe",
"task-id" : 73
},
{
"task-name": "Stage1Task3P",
"user-group-id": "Joe",
"task-id" : 123
}
]
} ] }}}}
Following the BlazeMeter tutorials, for the Regular Expression Extractor I use
Apply To "Main sample and sub-samples"
Field to check "Response Message"
Name of created variable taskId
Regular expression task-id"\ :\ (.\d+)$
$1$
(I have also tried taskId_1 - my ideal solution would set all the taskId's at once).
For the JSON Extractor that I just tried I use:
Names of created variables: taskId
JSON Path Expressions: $."task-id" (LOG ALL indicates Could not find JSON Path - so I will revise)
Match No: -1
Default Values: taskId not matched
It is as if none of these strings are ever matched so the values are not set - not even default values. I also have a Debug Sample, Debug Postprocessor and a View Results Tree included in the parent Logic Controller - but see no values of variables set anywhere (even in the logs).
I have other JSON extractors that attempt to traverse down the object tree from the top but they also are not setting my User Variables although LOG ALL indicates they are setting the variables of the same name.
What is wrong with my match expressions and assignment parameters?
How can I change my usage of Debug Sampler/Postprocessor/View Result Tree/Properties and variable viewer (which has JMeter variables = True) to observe variables?
Is there a way to run a test plan one step at a time (e.g., a preprocessor, a request, a postprocessor then another postprocessor) by clicking on UI elements?
Regular Expression Extractor:
"task-id"\s*:\s*(\d+)
More information: JMeter Regular Expressions
JSON Extractor:
$..task-id
More information: Jayway JsonPath
To view generated variables just add a Debug Sampler somewhere at the bottom of your script and add View Results Tree listener so Debug Sampler would be in its scope, see How to Debug your Apache JMeter Script for more details.
I'm trying to wrap my head around Jmeter functions and how to actually use them in an HTTP JSON request. All examples I've found on function use them as titles in HTTP requests, which is not helpful.
All I want to do is this, and then use that variable in my POST request. But that doesn't work and I have no clue why not.
...
"dates": {
"invoiceDate": ${testdate},
...
In all examples I've seen, the function is set as the HTTP sampler name, like so:
This is not helpful at all since I can't use that as a variable.
I don't think 20211 is the valid year, do you mean 2021?
If you put the function inside User Defined Variables - it will be evaluated only once and won't be random, you should rather inline it into the request body as User Defined Variables are evaluated only once, when the test starts
If you're trying to post JSON - I think you should surround the function with quotation marks, otherwise the JSON will be invalid. Suggested change:
{
"dates" : {
"invoiceDate": "${__RandomDate(,,2021-06-20,,)}"
}
}
New to Go. My first project is to compare a NodeJS proxy and a Go proxy for account number tokenization. I have been doing NodeJS for a few years and am very comfortable with it. My proxies will not know the format of any request or response from the target servers. But it does have configurations coming from Redis/MongoDB that is similar to JSONPath expression. These configurations can change things like the target server/path, query parameters, headers, request body and response body.
For NodeJS, I am using deepdash's paths function to get an array of all the leaves in a JSON object in JSONPath format. I am using this array and RegEx to find my matching paths that I need to process from any request or response body. So far, it looks like I will be using gjson for my JSONPath needs, but it does not have anything for the paths command I was using in deepdash.
Will I need to create a recursive function to build this JSONPath array myself, or does anyone know of a library that will produce something similar?
for example:
{
"response": {
"results": [
{
"acctNum": 1234,
"someData": "something"
},
{
"acctNum": 5678,
"someData": "something2"
}
]
}
}
I will get an array back in the format:
[
"response.results[0].acctNum",
"response.results[0].someData",
"response.results[1].acctNum",
"response.results[1].someData"
]
and I can then use my filter of response.results[*].acctNum which translates to response\.results\[.*\]\.acctNum in Regex to get my acctNum fields.
From this filtered array, I should be able to use gjson to get the actual value, process it and then set the new value (I am using lodash in NodeJS)
There are a number of JSONPath implementations in GoLang. And I cannot really give a recommendation in this respect.
However, I think all you need is this basic path: $..*
It should return in pretty much any implementation that is able to return pathes instead of values:
[
"$['response']",
"$['response']['results']",
"$['response']['results'][0]",
"$['response']['results'][1]",
"$['response']['results'][0]['acctNum']",
"$['response']['results'][0]['someData']",
"$['response']['results'][1]['acctNum']",
"$['response']['results'][1]['someData']"
]
If I understand correctly this should still work using your approach filtering using RegEx.
Go SONPath implementations:
http://github.com-PaesslerAG-jsonpath
http://github.com-bhmj-jsonslice
http://github.com-ohler55-ojg
http://github.com-oliveagle-jsonpath
http://github.com-spyzhov-ajson
http://github.com-vmware-labs-yaml-jsonpath
we have our static stack (CloudFront, S3, ..) defined as a configurable module for different projects. Now some of them need edge lambdas and I wanted to make them configurable (and optional(!)), too.
We are using the module as following:
module "static" {
..
lambda_function_associations = [
{
event_type = "viewer-request"
lambda_arn = "${aws_lambda_function.onex_lambda_viewer_req.qualified_arn}"
},
{
event_type = "viewer-response"
lambda_arn = "${aws_lambda_function.onex_lambda_viewer_res.qualified_arn}"
},
]
..
}
and the default cache behaviour of CloudFront is defined as the following:
default_cache_behavior {
..
lambda_function_association = ["${var.lambda_function_associations}"]
..
}
and our variable within the module:
variable "lambda_function_associations" {
type = "list"
default = []
}
Applying this stack I get:
Error: module.static.aws_cloudfront_distribution.web: "default_cache_behavior.0.lambda_function_association.0.event_type": required field is not set
Error: module.static.aws_cloudfront_distribution.web: "default_cache_behavior.0.lambda_function_association.0.lambda_arn": required field is not set
Is there no way to make them work optionally? I really dont want to duplicate the whole stack when adding an edge lambda.
Apparently something like this works for lb_health_check configuration blocks:
https://github.com/hashicorp/terraform/issues/17292#issuecomment-393984861
Thanks in advance!
I recently stumbled upon the same issue. This is caused by a terraform limitation, which prevents us from passing dynamic values to a nested block inside a module.
The only workaround I found was duplicating the resource declaration and creating one of the resources based on a condition in the count variable (pass a static variable here, e.g. associate_lambda_function).
You can find more details and an example in this gitlab snippet