Sitecore Healthchecks for SolrCloud do not include Switching indexes

Last week we had an issue that caused Sitecore to be unable to connect to SolrCloud. Therefore, the container Readiness healthchecks failed, resulting in loss of service. This has been fixed.

During the incident, we noticed in the telemetry that we were seeing Healthcheck Failures for most of the search indexes. However, not all – master, web, and preview were all missing. This was puzzling. One commonality between the missing checks was that all missing indexes used Switch on Rebuild functionality to ensure service, even during a full index rebuild.

Continue reading “Sitecore Healthchecks for SolrCloud do not include Switching indexes”
Sitecore Healthchecks for SolrCloud do not include Switching indexes

Making Application Insights record 404s as successful

We’re using AppInsights with our Sitecore10 system, and one frustration we have is that our “Failures” report contains thousands of entries for 404 responses. Unfortunately, these days, just having a site means you’re going to get a tonne of requests for “potentially vulnerable paths” – such as the WordPress login, Drupal Login, PHP Info pages, etc.. None of these paths are ever going to be in our site, and conceptually, is it really an error if we respond to someone who is spamming our site with requests that a particular page doesn’t exist? It’s just making it harder to see the genuine issues we actually care about.

To that end, I wanted to set some of the 4xx responses from our site to be “Successful” in AppInsights. I came up with this TelemetryInitializer…

Continue reading “Making Application Insights record 404s as successful”
Making Application Insights record 404s as successful

Enriching AppInsights Telemetry with additional information

We are running Sitecore 10 in containers, and we have multiple environments. We’ve also got multiple server roles. We’d like our telemetry to App Insights to tell us a) what instance is this for, and b) what role is this for.

We can achieve this with a TelemetryInitializer…

Continue reading “Enriching AppInsights Telemetry with additional information”
Enriching AppInsights Telemetry with additional information

Appending Sitecore Logs into Application Insights

Sitecore uses log4net, which makes it relatively easy to set up new destinations for logs, etc.. One request we’d had was to log messages in the Sitecore logs into Application Insights.

I approached this by writing a custom appender, which would take our messages and write them to App Insights as Trace messages. This is what I came up with:

Continue reading “Appending Sitecore Logs into Application Insights”
Appending Sitecore Logs into Application Insights

Splitting “Sitecore/Index” requests into their actual pages

Application Insights records requests for all content pages in Sitecore as being for “Sitecore/Index”. That’s because this is the controller route under which those pages are processed – but it’s not that helpful if you want to see things like the performance of individual pages. Well, there is an answer, as detailed by Per Osbeck – Application Insights: GETing a fix for Sitecore/Index | by Per Osbeck | Medium .

The short form of this is he used a TelemetryProcessor to update the item.Context.Operation.Name and request.Name to the absoluteUrl being processed.

Continue reading “Splitting “Sitecore/Index” requests into their actual pages”
Splitting “Sitecore/Index” requests into their actual pages

Sitecore’s LevelRangeFilter may unexpectedly terminate your log4net filter chain

TL;DR – Due to strange functionality and a poorly chosen default, Sitecore’s log4net.Filter.LevelRangeFilter may unexpectly terminate the chain of log4net filters you’ve configured, without later filters even being considered. This can be fixed by setting the “AcceptsOnMatch” attribute to false.

Continue reading “Sitecore’s LevelRangeFilter may unexpectedly terminate your log4net filter chain”
Sitecore’s LevelRangeFilter may unexpectedly terminate your log4net filter chain

Azure WAF does not play nicely with Web Apps

Recently I’ve been working on a Sitecore site that is using Azure App Gateway, and it is using the Web Application Firewall (WAF) features of that too. Broadly, I’ve been quite impressed, but I did come across a few problems.

OWASP publish a set of rules used in ModSecurity to try to identify anomalous traffic. These rules then total into a score of “how anomalous this request is”. Finally, there is one rule that checks that score, and potentially blocks traffic based on it.

We found we were getting traffic blocked. Here’s what we found.

Continue reading “Azure WAF does not play nicely with Web Apps”
Azure WAF does not play nicely with Web Apps

Sitecore TDS – Could not find assembly Sitecore.Data.Resourceitems.Protobufnet.dll

So I am working on a Sitecore 10.1.2 project, and we’re using TDS 6.0.0.36. When I tried building the update package I got the error:

GENERATEPACKAGE : error : Could not find assembly sitecore.data.resourceitems.protobufnet.dll
GENERATEPACKAGE : error : Could not find assembly sitecore.data.resourceitems.abstractions.dll
C:\git\Blah\packages\HedgehogDevelopment.TDS.6.0.0.36\build\HedgehogDevelopment.TDS.targets(186,5): error : The package builder failed. Please set the build logging level to Normal or Detailed and see the build output log for more information on the failure.

This was odd, as Sitecore 10.1.2 does not contain either of those assemblies. But they did look familiar. After a bit of digging, I found them… in Sitecore 10.2. But I’m not using Sitecore 10.2… but that’s what it’s looking for.

Continue reading “Sitecore TDS – Could not find assembly Sitecore.Data.Resourceitems.Protobufnet.dll”
Sitecore TDS – Could not find assembly Sitecore.Data.Resourceitems.Protobufnet.dll

Setting Application Insights connection string for Client JavaScript

So, if you’re using Application Insights, you may choose to use the client-side JavaScript API. This is a snippet that will allow you to use Application Insights in JavaScript – and conventiently it records lots useful error, dependency and trace data, allow with PageView data. It’s pretty nifty, and also supports filters and telemetry enrichment.

In that snippet, you’ll find lots of mention of a configuration setting “instrumentation key”. This is the ID of the app insights instance that your data will be sent to.

The thing is, it has been deprecated in favour of “connection string”. This is the same connection string as you use server-side (as described previously), and can be read from:

string aiConnection = TelemetryConfiguration.Active?.ConnectionString;

You should do this and render the connection string rather than hard-code it into your layout page.

Setting Application Insights connection string for Client JavaScript