Skip to content

Instantly share code, notes, and snippets.

pacodelacruz

Block or report user

Report or block pacodelacruz

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
View ErrorCountByEventId.kql
traces
| sort by timestamp desc
| where customDimensions.EventId > 1
| where customDimensions.LogLevel == 'Error'
| project EventId = tostring(customDimensions.EventId)
| summarize Count = count(EventId) by EventId
View CorrelatedByEntityId.kql
//Change the pEntityId to get the traces for a particular business document
let pEntityId = "2000";
traces
| sort by timestamp desc
| where customDimensions.EventId > 1
| where customDimensions.prop__CheckPoint == 'Publisher'
| where customDimensions.prop__EntityId == pEntityId
| project Level = customDimensions.LogLevel
, PublisherEventId = customDimensions.EventId
, PublisherEventDescription = customDimensions.prop__EventDescription
View CorrelatedTraces.kql
//Properties used with Azure Functions structure logging are logged as customDimensions.prop__{name}
//To filter events created by our custom structured logging, get only those traces where EventId > 1
//To correlate different checkpoints, we use the CorrelationId
traces
| sort by timestamp desc
| where customDimensions.EventId > 1
| where customDimensions.prop__CheckPoint == 'Publisher'
| project Level = customDimensions.LogLevel
, PublisherEventId = customDimensions.EventId
, PublisherEventDescription = customDimensions.prop__EventDescription
View GetAllTraces.kql
//Properties used with Azure Functions structure logging are logged as customDimensions.prop__{name}
//To filter events created by our custom structured logging, get only those traces where EventId > 1
traces
| sort by timestamp desc
| where customDimensions.EventId > 1
| project Level = customDimensions.LogLevel
, EventId = customDimensions.EventId
, CheckPoint = customDimensions.prop__CheckPoint
, CorrelationId = customDimensions.prop__CorrelationId
, Description = customDimensions.prop__Description
View host.json
{
"version": "2.0",
"logging": {
"logLevel": {
"default": "Information"
},
"aggregator": {
"batchSize": 100,
"flushTimeout": "00:00:10"
},
View ProcessOrder.cs
using Microsoft.Azure.WebJobs;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.IO;
namespace PacodelaCruz.AzureFunctions.Logging
{
public static class ProcessOrder
View SubmitOrder.cs
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.ServiceBus;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using Newtonsoft.Json;
using System;
using System.IO;
View LoggingConstants.cs
namespace PacodelaCruz.AzureFunctions.Logging
{
/// <summary>
/// Contains constants and enums for consistent structured logging
/// </summary>
internal static class LoggingConstants
{
// Template for consisted structured logging accross multiple functions, each field is described below:
// EventDescription is a short description of the Event being logged.
// EntityType: Business Entity Type being processed: e.g. Order, Shipment, etc.
@pacodelacruz
pacodelacruz / AzureCli.sh
Last active Jul 25, 2018
Azure CLI Snippets
View AzureCli.sh
az provider show --namespace Microsoft.Cache --query "resourceTypes[?resourceType=='Redis'].apiVersions | [0]"
az provider show --namespace Microsoft.ServiceBus --query "resourceTypes[?resourceType=='namespaces'].apiVersions | [0]"
az provider show --namespace Microsoft.ServiceBus --query "resourceTypes[?resourceType=='namespaces/topics/'].apiVersions | [0]"
az provider show --namespace Microsoft.ServiceBus --query "resourceTypes[?resourceType=='namespaces/topics'].apiVersions | [0]"
az provider show --namespace Microsoft.Web --query "resourceTypes[?resourceType=='connections'].apiVersions | [0]"
az provider show --namespace Microsoft.OperationalInsights --query "resourceTypes[?resourceType=='workspaces'].apiVersions | [0]"
az provider show --namespace Microsoft.OperationsManagement --query "resourceTypes[?resourceType=='solutions'].apiVersions | [0]"
az provider show --namespace Microsoft.Logic --query "resourceTypes[?resourceType=='integrationAccounts/maps
'].apiVersions | [0]"
View GetStatus.cs
using Microsoft.AspNetCore.Http;
using Microsoft.AspNetCore.Mvc;
using Microsoft.Azure.WebJobs;
using Microsoft.Azure.WebJobs.Extensions.Http;
using Microsoft.Extensions.Logging;
using System.Threading.Tasks;
namespace PacodelaCruz.DurableFunctions.AsyncHttpApi
{
public static class GetStatus
You can’t perform that action at this time.