CloudWatch Logs Insights query, How to return only last request set of data - aws-cloudwatch-log-insights

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.

Related

Filtering by matching / non matching attributes on AWS 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

VSTS Get ID of Stored Queries

I am trying to execute a VSTS stored query using WorkItemTrackingHttpClient
The stored query is identified by it's ID and there are code samples to programmatically get this ID. However, I can't seem to figure out how I can get this ID within VSTS online view. Clicking on the query lists the workitems returned bye this query but the query ID isn't listed anywhere. Is this due to privileges of my authentication or I am overlooking something.
You can get the query ID in the URL:
Select a query
The URL format will be like: https://[xxx].visualstudio.com/[project]/_queries?id=effb4d62-1b9b-42e9-af7c-dbef725fca4a&_a=query.
The id is the value of id parameter.

How to count push events on GitHub using BigQuery?

I'm trying to use the public GitHub dataset on BigQuery to count events - PushEvents, in this case - on a per repository basis over time.
SELECT COUNT(*)
FROM [githubarchive:github.timeline]
WHERE type = 'PushEvent'
AND repository_name = "account/repo"
GROUP BY pushed_at
ORDER BY pushed_at DESC
Basically just retrieve the count for a specified repo and event type, group the count by date and return the list. BigQuery validates the following, but then fails the query with a:
Field 'pushed_at' not found.
As far as I can tell from GitHub's PushEvent documentation, however, pushed_at is an available field. Anybody have examples of related queries that execute properly? Any suggestions as to what's being done incorrectly here?
The field is called repository_pushed_at, and you also probably meant to include it in the SELECT list, i.e.
SELECT repository_pushed_at, COUNT(*)
FROM [githubarchive:github.timeline]
WHERE type = 'PushEvent'
AND repository_name = "account/repo"
GROUP BY repository_pushed_at
ORDER BY repository_pushed_at DESC

Joining two tables and fetching records in a single query in FQL

Hi i have written a query by which i can fetch posts,actor_id,comments and other columns required from stream table. But i want to fetch user's name also along with actor id and other columns in a single query.
My queries is :
select message,created_time,actor_id,attachment,comments,created_time,impressions,likes,message,message_tags,place,share_count from stream where source_id in (any_page_id)
I want to add user's name also from user table along with this list of columns i am fetching from stream table in a single query so that i can handle it in a single json file. .
Also in comments we will get several user's id with comments as from_id. Can we get username for this from_id also. Is this possible, i know we cannot use join in FQL. Or i am missing something or in a wrong approach. Please help me out. Thanks in advance.
Updated
Now i am able to get actor_id and other fields of the post together along with user's name at the end in the same json using multi-query. Something similar to :
fql?q={"query1":"select+message,created_time,actor_id,attachment,comments,created_time,impressions,likes,message,message_tags,place,share_count+from+stream+where+source_id+in(any_page_id)","query2":"select uid,name from user where uid in (*#query1* "}
But now i am not able to get the user's name and user's id who are there in the comments of the post in the same json.

Can the with function be used with a GroupBy clause in Laravel Eloquent?

Can the with function be used with a GroupBy clause in Laravel Eloquent? Does it serve any purpose if I have specific items to select using the Select Clause?
Following is the query that I currently have
Order::with('Campaign')
->where('isapproved','=','Y')
->groupBy('campaign_id')
->orderBy(DB::raw('COUNT(id)','desc'))
->get(array(DB::raw('COUNT(id) as totalsales')));
The order table has a column name campaign_id which belongsTo the table named campaigns. I would like to get the total count of the sales from the order table against each campaign and need to show in the following manner.
Total Sales Campaign
-------------------------
200 Campaign1
500 Campaign2
300 Campaign3
Should I have to perform a specific select or can I access the values of the Campaign table from the above query?
If the referenced column required by the Model specified on the With function is retrieved in the SELECT clause, then the With function is taken into consideration by the above query. The rectified query will be
$groupedSalesCampaign = Order::with('Campaign')
->where('isapproved','=','Y')
->groupBy('campaign_id')
->orderBy(DB::raw('COUNT(id)','desc'))
->get(array(DB::raw('COUNT(id) as totalsales'),'campaign_id'));
This way the Campaign information can be retrieved using
foreach($groupedSalesCampaign as $campaign)
{
Log::info($campaign->foo->bar);
}
Edited.