Using parameters in Azure Service Bus Subscription SqlFilter expression - azure-resource-manager

I am using an ARM template to try and deploy a subscription to an Azure Service Bus Topic which filters messages based on the To system property. I would like to pull the value for the filter from an ARM template parameter, but I can't seem to get the template to resolve the param in the SqlExpression.
Below is the template I have been messing around with. I thought I could maybe just toggle the requiresPreprocessing switch to get it to resolve the param on deployment, but no dice. I also played with trying to escape it using double square brackets or colons as shown in the link below
https://learn.microsoft.com/en-us/azure/service-bus-messaging/service-bus-messaging-sql-filter#propertyname
{
"apiVersion": "2017-04-01",
"name": "[concat(parameters('mynamespace'), '/', parameters('topic'), '/', parameters('myVariable'),'/direct')]",
"type": "Microsoft.ServiceBus/namespaces/topics/subscriptions/rules",
"dependsOn": [
"[resourceId('Microsoft.ServiceBus/namespaces', parameters('mynamespace'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics', parameters('mynamespace'), parameters('topic'))]",
"[resourceId('Microsoft.ServiceBus/namespaces/topics/subscriptions', parameters('mynamespace'), parameters('topic'), parameters('myVariable'))]"
],
"properties": {
"filterType": "SqlFilter",
"sqlFilter": {
"sqlExpression": "sys.To=[parameters('myVariable')] OR sys.To IS NULL",
"requiresPreprocessing": true
}
}
What I am getting is the string exactly as it is displayed in the sqlExpression, but I would like to get the value that the variable resolves to in a single quoted string.

This topic subscription rules may only get static values. Maybe you can try with a static value instead of [parameters('myVariable')]. This problem might because of giving dynamic value to the property sys.To.

You could use: "[concat('sys.To=',[parameters('myVariable')],' OR sys.To IS NULL')]".
You cannot use inline expressions in an ARM template I think, therefor you should make the whole thing an expression and in this case use concat to glue the parts together.
Hint: including single quotes is difficult, so a variable like this might come in handy:
"SQ": "'"

Related

JSONPath concat arrays and joing

I am trying to use JSONPath expression to extract 2 arrays and concatenate them today to form a long array - and ideally making them unique. However, no syntax I use in the online playground produces results. Ultimately I will want to use this in a Jenkins job. So, it has to be operational with the Java implementation
Here is my json
{
"commits": [
{
"author": {
"name": "Christian",
"email": "christian#company.com"
},
"added": [
"deleteme/main.tf"
],
"modified": [
],
"removed": [
"deleteme.txt"
]
}
]
}
And here is my expression (which I am trying to evaluate here):
$.append($.commits[*].added[*], $.commits[*].removed[*])
Which I would love to see as
["deleteme/main.tf", "deleteme.txt"]
Or better still:
"deleteme/main.tf, deleteme.txt"
because ultimately I need a comma separated set of values
Oh yeah: Bonus for only unique results
JSON Path is a query language. Some tools have used it to enable transformation functionality, but this is not something that JSON Path itself generally supports.
Disclaimer and Open Specification Plug
The online tool you linked is not "official." There is no "official" tooling because there is no specification. Pretty much everyone has been building implementations from a 15yo blog post and adding their own features.
But there's good news: we're building a spec!

Overriding appsettings.json values from Azure App settings

I have a set of appsetting vaues as below. We are on Windows App service
"MainDomains": {
"Domains": [
{
"Id": "123456",
"Domain": "Technical",
"PolicyUrl": "https://www.mytechdomain.net",
"LearningPoint": "https://www.mytechdomain.net",
"Hostnames": [
"https://localhost:4567",
"http://localhost:34565",
"https://mytechdomain.latestlearn.com"
],
"UsePreviewContent": true,
"IsDefault": true,
"OriginEmail": "info#techdomain.net",
"mytechname": "Techdomain"
}
]
}
How would i properly set these values in Azure App settings under configurations. I have already tried like property1:property2:0 --> xxxvalue. This does not seem to work however. What I am guessing is may be I have an array within another array. Where first array is the MainDomains and another array within the MainDomains array is the Domains.
You should set the app setting name with the same delimited format in the appsettings.json. But just like Gaurav Mantri said, use double underscore __ rather than : on portal.
Refer to the description about Configuration keys and values:
In environment variables, a colon separator may not work on all
platforms. A double underscore, __, is supported by all platforms and
is automatically converted into a colon :.
You could also have a look at the official document about how to set App Settings.

Choosing the right name for properties in schema for Weaviate

When loading my schema into Weaviate, I get an error message that the property name can not be found in the contextionary. Some of the properties I need are abbreviations.
This is the schema item it is complaining about:
{
"cardinality": "atMostOne",
"dataType": [
"boolean"
],
"description": "Is this a BLWS elbow yes or no",
"keywords": [
{
"keyword": "BLWS",
"weight": 1
}
],
"name": "blws"
}
This is the error message I get:
2019-09-04T11:47:07.202646 ERROR: {'error': [{'message': "Could not
find the word 'blws' from the property 'blws' in the class name
'Elbow' in the contextionary. Consider using keywords to define the
semantic meaning of this class."}]}
The misleading error
The error message
Consider using keywords to define the semantic meaning of this class
is outdated and and the recommendation in fact not helpful. There is already a GitHub issue to clean this up: https://github.com/semi-technologies/weaviate/issues/929
Prior to https://github.com/semi-technologies/weaviate/issues/856 it was possible to replace an unknown property word with known keywords, but #856 removed that possibility.
However, even prior to the change your schema would not have been accepted, see below.
About property names which are not in the contextionary
A property name consist of one or more recognized parts which is known by the contextionary. By "part" I mean that if you combine multiple words using camelCasing each word would be one part. So for example
drivesVehicle would be valid as it consists of two known words: drives, vehicle
drivesAVehicle would also be valid, as it contains two known words and a stop word (a). Note: Stopwords are fine as long as your property contains at least one non-stopword.
drivesBlws would be invalid, as blws is not a known word
We have discussed adding an ability to add custom words. The proposal can be considered accepted, but at the time of this writing it is not in immediate prioritization.
Why so strict about known words?
One of the core functionalities of weaviate is concept searching ("vector-based searching"), so weaviate must be able to calculate a vector position for each property. It can only do that if it recognizes the words
How to solve this?
Try describing a "blws" with known words. For example if "blws" was an acronoym for "bold long wide short", you could name the property boldLongWideShort. As mentioned above, we will add the ability to add custom words in the future, but as of now that's not supported yet.

How to set component Maximum age field in Nexus repository 3.5 using API's

I am using the simple create script to add the script to the repo manager successfully : https://github.com/sonatype/nexus-book-examples/blob/nexus-3.x/scripting/simple-shell-example/create.sh
and passing a JSON file like this
{
"name": "apachesnapshots",
"type": "groovy",
"content": "repository.createMavenProxy('apachesnapshots-io',
'http://repository.apache.org/snapshots/', 'default' ,org.sonatype.nexus.repository.proxy.ContentMaxAge.-1)"
}
For Release repositories, it says that the Maximum component age should be -1. I am getting 1440 by default. I have figured out the parameter that i need to pass in repository.createMavenProxy() should be ContentMaxAge. But not able to figure out if it should be added at a particular position and how to set its value to -1.
You can use the Repository Manager within the API to get attributes and then change them accordingly.
To see the configuration, use a script like:
return repository.getRepositoryManager().get('my-proxy-repo').getConfiguration()
To change them, use something like:
repository.getRepositoryManager().get('my-proxy-repo').getConfiguration().getAttributes().'proxy'.'contentMaxAge' = -1
Hope it helps,
Steve

Aggregating a list of http log paths in kibana

I have a nginx->fluentd->elasticsearch->kibana stack up and running. Trying to figure if I can do something like a "terms" panel but with a path string component from logs. Using a terms panel directly on that results in top used words from paths, e.g. for drupal it shows "node" as the most popular, which is quite useless without actual node id.
Is that something that is possible to do with elasticsearch?
Update: Here's a sample of my logs:
"path": "/node/123"
"path": "/node/456"
"path": "/user/create"
If I add a "terms" panel for "path" field, I get columns for "node", "user", "create", which make no statistical sense. What I need is a terms panel that aggregates on unique field values, not unique word parts of the field.
You need to configure Elasticsearch's mapping for setting your "path" field as a "not_analyzed" one. The default setting is "analyzed" and by default, ES parses the string fields and divide them in multiple tokens when possible, which is probably what happened in your case. See this related question.
As for how to configure Elasticsearch's mapping, I am also still digging, having a similar problem myself with multi-token strings I want to be able to sort on. It seems like there would be a put mapping API or the possibility of using config files, see here.

Resources