Filtering by matching / non matching attributes on AWS Insights - aws-cloudwatch-log-insights

I am trying to search for messages on AWS Insights with either matching or non matching attributes.
Specifically, Suppose I have an attribute "resp" and I want to search for messages which do not contain att.resp. Is something like that even feasible on AWS Insights?
fields #timestamp, #message
| sort #timestamp desc
| filter #message not like att.resp

Related

CloudWatch Logs Insights query, How to return only last request set of data

Having this AWS Cloudwatch Logs Insights query:
fields #timestamp as ``invoke time``, #requestId, id, name, status, nextStatus, nextStatusDelay | filter #message like /nextStatusDelay/ | filter #message not like /handlerObject/ | sort ``invoke time`` desc
That returns data set shown in image.
Is there a way to filter the result to show only data for the latest request?
In this example rows that include requestId "ca04da81-5061-4986-b2f1-681de2bd9995".
I can't pass any hardcoded value like requestId or number of row returned. I would like those arguments to be dynamic.

How to query datasets by group with CKAN API?

I have managed to create a query to get datasets by tags. For reference I have the following query:
http://localhost/api/3/action/package_search?fq=tags:(my-first-tag%20AND%20my-second-tag)&rows=2
Now, I need to filter these results by the group also. I added a dataset to a group and can see the group as:
http://localhost/api/3/action/group_list
But how can I add the group to the previous query? I can't seem to find anything that works.
You can use the filter query (fq) to search using the group name. For e.g to search the datasets that are in the test group
https://demo.ckan.org/api/3/action/package_search?fq=groups:test-group
To include the two fq, we need to make the query like this:
http://localhost/api/3/action/package_search?fq=tags:(my-tag-1%20AND%20my-tag-2)+groups:my-group-1&rows=2

How to define a tags / value query in Grafana 7.4?

I am having some trouble understanding the concept of Value groups/tags in Grafana 7.4.x with MySQL as a data source.
My main query gets the Countries
SELECT
NAME as __text,
id AS __value
from
countries
The tags query gets the Continents
SELECT
NAME as __text,
id AS __value
from
continents
That works so far, tags are shown in the list, but nothing happens once I click on them.
My tags query:
continents.$tag.*
The tags query seems to be the problem. Any help is greatly appreciated.
3 queries are involved:
The first one is under "Query Options" -> "Query": This one should list all the values (all the countries in your case).
The second query is the "Tags query" under "Value groups/tags": This query should list all the Tags you want (continents).
The third query is "Tag values query": This is where the magic happens, this query should return all the different values matching the selected tags, so, you must add a WHERE clause somewhere that Grafana will use to create a query to get the correct values, ...WHERE continent = '$tag'. <- $tag will automatically be replaced by a list of tags the user has chosen.
Be aware that the official documentation provides examples for InfluxDB datasource, since you are using MySQL, you must use SQL queries everywhere, so continents.$tag.* is invalid.

postgresql multiple column search with ranking

I want to search for multiple columns in multiple tables. Like this:
Given tables:
Users
id
first_name
last_name
email
Companies
user_id
address
Lands
name
company_id
Lets say User is Johny Bravo(johny.bravo#gmail.com) working in Washington in United States.
I want to find the record based on query
"ate" -> from United States, or
"rav" from Bravo
When I type "rav" my Johny Bravo rank is higher than Johny Bravos with other emails so it is first in results
How can I implement such functionality?
I've looked at ts_vector and ts_rank but it seems that it supports only right wildcard ("to_tsquery('Brav:*')") will work, also I don't need full-text-search functionalities(I will look for adresses and usernames so no need to alias names etc.) I can do wildcard search but then I would have to manually calculate ranking in application
You could use pg_trgm extension.
You must have the contrib installed, then you install the extension:
create extension pg_trgm;
Then you can create trigram indexes:
create index user_idx on user using gist (user_data gist_trgm_ops);
And you can then query which will give you first 10 most similar values:
select * from user order by user_data <-> 'rav' limit 10;
Note that you can replace user_data with an immutable function, which can concatenate all of the info into one (text) field thus enabling search across more fields.
To get "ranking score", you can use similarity function, which returns 1 for identical strings and 0 for completely unrelated.
If you need full text search across whole database, a better solution might be a separate search facility, such as Apache Solr.

SharePoint 2013 REST How to select a look up field and also filter based on look up field?

I can't select look up field in my SharePoint 2013 List.
also I can't filter base on a Look up field.
for example I have List with Name Test and this list has fields: Title, Company, Province
the Company and Province is look up fields I want to filter based on Province which is a look up field
using REST query it gives error:
my query:
https://TestServer/sites/AIB/OBC/_api/web/lists/getByTitle('Test')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq 'ABC'
it gives error when I put the URL in My browser for testing it gives the blow error:
<m:message xml:lang="en-US">The field or property 'Province' does not exist.</m:message>
How to filter based on a look up field in SharePoint 2013 REST ?
How to filter by lookup field value using SharePoint REST
Assume a Contacts list that contains a lookup field named Province
Option 1
When a lookup column is being added into list, its ID become accessible automatically via REST. For example, when the field named Province is added into List, Province Id could be set or get via ProvinceId property of List Item.
The following query demonstrate how to filter list items by lookup field Id (Province Id in our case):
/_api/web/lists/GetByTitle('<list title>')/items?$filter=LookupField eq <ProvinceId>
where <ProvinceId> is a province id
Option 2
In order to filter by lookup value, the query should contain $expand query option to retrieve projected fields (like Province Title). The following example demonstrates how to filter by lookup field value (by Province Title in our case):
/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq <ProvinceTitle>
where <ProvinceTitle> is a Title of Province
Use $expand like blow code:
/_api/web/lists/GetByTitle('Test')/items?$select=Province/Title&$expand=Province&$filter=Province/Title eq 'XYZ'
Mehdi jalal, I found why it was throwing that error. You need to close your ProvinceTitle with Single Quotes and there you have it. like this
Query Syntax:
/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title,Province/ID&$expand=Province&$filter=Province/Title eq '<ProvinceTitle>'
Now this is Example Query:
/_api/web/lists/GetByTitle('Contacts')/items?$select=Province/Title,Province/ID&$expand=Province&$filter=Province/Title eq 'Detroit Province'