Azure function log that is older than 20 days - azure

I'm trying to look at the logs for my Azure function,
In the Monitor view, I can just click the link under the Date column for the logs for a certain run.
But this is only for the last 20 invocation. For the older log how can I get it?
After clicking the Run query in Application Insight link above,
I arrived to a page with a table with the log entry, but I don't know how to open the actual logs!

If you want to access to the logs of an execution of your function app prior to those top twenty and you don't know so much how to query in Application Insights. There is an alternative using pre made queries available at monitor tab of your function.
Go to "Run query in application insights" to find the specific execution you are looking for.
This will auto generate for you the same query that filled the above grid. Here you just need to change the timestamp where condition to match our needs.
For example a specific date and time range:
"where timestamp between (todatetime('2022-10-01T00:00:00Z')..todatetime('2022-10-01T23:59:59Z'))"
With this change just run the query and identify function run you want to get full logs and get its operation_Id and invocationId values.
Go to monitor view again, select any execution and then "Run query in Application Insights"
Now you only need to replace operation_Id and invocationId values with those you got at step 1 and run again the query to get full log of that specific execution.

Related

Application Insights alert for no log is written

I try to create a azure alert rule which should be triggered in case my service do not log anything.
I created a query to check if my service logs something. This works fine until there are no logs in the specified time (e.g. give the provided query a filter criteria for the timestamp).
Query: customEvents | where name == 'ShouldBeLoged' | limit 1
This query will just give me the query result: No results found from the last 24 hours.
If create a alert of this query the alert view shows me this (see picture):
Has someone an idea how I could achieve that the alert is triggered in case the service do not log anything?
Follow the workaround to trigger the alert if the threshold value less than 1(Means no log written):
Here I am fetching the one Limit value of custom event.
Workaround follows
Create alert with threshold if it less than 1 mean it will fire the alert
Here the query we used to fetch the single custom event.
We fetch single custom event, so we check the threshold value is less than 2 (it will fire if the event values is less than 2).
Result

Azure Storage Account file details in a table in databricks

I am loading data via pipelines in ADLS gen2 container.
Now I want to create a table that has details that when the pipeline start running and then completed. like below fields
where
startts - start time of job
endts- end time of job
but extractts is the extraction time which is what i want to create.. is there any approch i can create table ?? help will be really appreciated.
It might not be exactly what you need, but you can add columns inside a copy activity with the property #pipeline().TriggerTime to get your "startts" field. Go to the bottom option on the source tab and select new, and on value choose "Add dynamic content".
Here is an example
For your "extractts" you could use the property of the activity called "executionDuration", which will give you the time it took to adf to run the activity in seconds. Again, use dynamic content and get this: #activity('ReadFile').output.executionDuration, then store this value wherever you need.
In this example I'm storing the value in a variable, but you could use it anywhere.
I dont understand your need for a field "endts", I would just simply do startts+extractts to get it.

How to create datadog 'change alerts' using terraform?

I am trying to create a change monitor using terraform. To create a monitor that checks that overtime a count stays at 0 for example every day (the value will go up to one some times and get back to 0).
I found on the UI the capacity to create a change alert.
I cant seem to find a way to define the configuration for this type. Is terraform just supporting only a subset of the monitors? or does the query need to be change in some specific way that I cant find documentation for?.
I've stumbled upon this as well. I just figured out you have to manually create the monitor using "change alerts" then go to "manage monitors" page, open the one you just created and you'll see the query that starts with change(...). Copy the whole query to the query field in your terraform config.

Azure devops changed list of work items during a time period

Is there a way to find out the list of Azure Devops work items that were changed in a given period of time ?
Something like "The list of test case work items that were changed in the last 60 days". The change can include changes to any of the fields configured for the work item.
Use case: Today, we have the manual test cases and they are being automated. If the manual test case changes, we need to update the automated test as well.
So, I'm looking for a way to find out the list of work items that were changed in any way in a given time period.
In Azure DevOps, go over to your project and under Boards you have a Queries tab.
You can create a query there using the Work Item Type [Any] and Changed Date > #StartDate("-60d").
I've added an image if it is easier.
There is also API available for this, and you can automate that however you prefer.

How to get alerted for new (unique) errors

A useful feature of application monitoring services is sending alerts (e.g. emails) each time a new, unique error/problem/exception occurs (i.e., not for each occurrence). Either only the very first time, or at most once per X time (a day or week or such). This is, for example, possible with Visual Studio App Center. Unfortunately I haven't been able to find any such feature in Application Insights.
For clarification, a "new, unique error/problem/exception" can be thought of as a specific log statement in the code. I'm using Serilog, so all logged traces/exceptions have a MessageTemplate property which may help. But ideally the "problem ID" would be based on the code location, too (since multiple log statements may use the same message template).
The best lead I have found is the ability to send alerts based on a custom analytics query, but I'm not sure if it's possible to write a query that can give a behaviour similar to (if not exactly like) to what I describe above.
Is something similar to the behaviour I describe above possible to achieve with Application Insights? If it's possible through a custom query, how might such a query look?
Just through UI of azure portal, it's hard or impossible to achieve your first requirement: alert only the very first time. But you can try to use app insights rest api to fetch the data, then use code to implement your logic.
There is a similar solution(not exactly like you describe) for alert once per X time. The steps are as below:
1.Nav to azure portal -> you application insights -> Alerts -> new alert rule -> in the Condition, click Add button -> then select "Custom Log Search"
2.In the "search query" textbox, write your query like below:
exceptions
| where xxxx
Note that in the where clause, use some properties to identify the unique error.
3.Then in the "Alert logic", use the following settings:
Based on: Number of results, Operator: Greater than, Threshold value: 0
4.In the "Evaluated based on", set proper value for Period(max value is 2880 minutes) / Frequency(max value is 1440 minutes).
So if you want to trigger alert 1 time per day, you can set Period to 1440 minutes, set Frequency to 1440 minutes. But you also need to note that, if in the next day, there is no such specified error, it will not trigger in the next day.

Resources