Install NewRelic Agent to Azure App Service on Linux (.Net Core Website)

Hi, everybody,

We have 25+ websites running on .NET and .Net Core in Azure App Service on Windows. All of them have NewRelic ARM connected and everything seems to be ok.

Recently we tried to connect NewRelic to our newest websites on .Net Core running in Azure App Service on Linux and we couldn’t cope with it. We used this document as guide:

Sorry, that’s the end of my post:

We used this document as guide:
https://docs.newrelic.com/docs/agents/net-agent/azure-installation/install-net-agent-azure-web-apps#nuget-install-net-core

Some details to make issue more clear:

  • We have one library project in solution incapsulating service functionality such as sending messages to monitoring service (to NewRelic). There’re NewRelic.Agent.Api Nuget Package installed.
  • We had no newrelic.config file because we didn’t need it before. But according to guide mentioned above, we created simple newrelic.config, containing only ‘configuration’ and ‘log’ sections.
  • We published our ASP.Net Core 3.1 application to Azure AppService on Linux with this newrelic.config, added application settings in App Service configuration, restarted app, and nothing’s appeared in our NewRelic ARM even 30 minutes later.

It seems that we still need to install NewRelic Agent somehow but we can’t understand how to do it as there’s no way to install NewRelic Extention to Azure AppService on Linux.

Could you please provide us some more guidance how to install NewRelic to ASP.Net Core application in Azure App Service on Linux?

Hi @julia.aniskina!

This is Reese with New Relic Support. Thank you for getting this information over to us.

I’d like to start with your newrelic.config file. You mentioned that it only contains the parent element <configuration> and a child <log> element.

In order for the config file to be parsed correctly, it actually needs to have a standard set of elements. Here is a standard newrelic.config file:

<?xml version="1.0"?>
<!-- Copyright (c) 2008-2019 New Relic, Inc.  All rights reserved. -->
<!-- For more information see: https://newrelic.com/docs/dotnet/dotnet-agent-configuration -->
<configuration xmlns="urn:newrelic-config" agentEnabled="true">
	<service licenseKey="REPLACE_WITH_LICENSE_KEY" />
	<application>
		<name>My Application</name>
	</application>
	<log level="info"/>
	<transactionTracer enabled="true"
		transactionThreshold="apdex_f"
		stackTraceThreshold="500"
		recordSql="obfuscated"
		explainEnabled="false"
		explainThreshold="500"/>
	<crossApplicationTracer enabled="true"/>
	<errorCollector enabled="true">
		<ignoreErrors>
			<exception>System.IO.FileNotFoundException</exception>
			<exception>System.Threading.ThreadAbortException</exception>
		</ignoreErrors>
		<ignoreStatusCodes>
			<code>401</code>
			<code>404</code>
		</ignoreStatusCodes>
	</errorCollector>
	<browserMonitoring autoInstrument="true" />
	<threadProfiling>
		<ignoreMethod>System.Threading.WaitHandle:InternalWaitOne</ignoreMethod>
		<ignoreMethod>System.Threading.WaitHandle:WaitAny</ignoreMethod>
	</threadProfiling>
</configuration>

Let’s start here. Thank you,
Reese

1 Like

Hi, reeselee,

Thanks for your reply.
I copied newrelic.config posted by you. Then I put into file our licence key and published app to server. After that I restarted app on Azure. There’s still no data in New Relic ARM 20 minutes later.
Is there anything else I need to do?

Hi @julia.aniskina,

I am not sure if you have seen this guide on installing the agent for Linux:

https://docs.newrelic.com/docs/agents/net-agent/installation/install-net-agent-linux

From the main installation guide you were following, it states:

New Relic .NET Core agent supports Linux and Windows applications on Azure App Services. The installation process for Azure App Services differs from the .NET Core agent installation procedures for Linux and Windows.

Can you let me know if you have tried these steps?

Thank you! Talk soon,
Reese

1 Like

Hi, reeselee,

No, I haven’t tried those steps althouhg I’ve seen that installation guide. I’m not sure how can I run Linux commands in Azure App Service. Azure doesn’t provide interface to interact with inner staffs of App Service as if it was ordinal Linux server. Or at least I’m not aware of it.
Do you know any way to run on Azure App Service Linux commands such as apt-get?

Hello again @julia.aniskina,

Thank you for your patience! After collaborating with my colleagues, I have a few notes for you:

  1. The agent can’t be installed via the usual Linux commands

  2. Can you check your app settings for the following settings:
    CORECLR_PROFILER_PATH_32
    CORECLR_PROFILER_PATH_64
    and point them both at libNewRelicProfiler.so if they aren’t already

  3. Can you check to see if your newrelic.config file is encoded with a byte order mark? The config file won’t be parsed correctly if it is encoded with a BOM.

Thank you,
Reese

reeselee,

Thank you for your help.
I changed values for
CORECLR_PROFILER_PATH_32
CORECLR_PROFILER_PATH_64
to libNewRelicProfiler.so (previosly they’re set to D:\Home\site\wwwroot\newrelic\x86\NewRelic.Profiler.dll).
I also resaved newrelic.config so now it’s encoded in UTF-8 (not in UTF-8 with BOM).
Then I published and restarted my app. Againg there’s nothing in NewRelic ARM.

Is there anything else I need to do?

Hi @julia.aniskina,

I went ahead and opened a ticket on your behalf to look into this further.

Thank you,
Reese

NewRelic team helped me to solve my issue. Thank you for your work, NewRelic team!

I post here guide how to connect NewRelic to website on Azure App Service on Linux. Hope it can help somebody in future.

  1. Set application setting as follows (no colons are needed, they’re there only for division of parts of data):
  • CORECLR_ENABLE_PROFILING : 1
  • CORECLR_NEWRELIC_HOME : /home/site/wwwroot/newrelic
  • CORECLR_PROFILER : {36032161-FFC0-4B61-B559-F6C5D41BAE5A}
  • CORECLR_PROFILER_PATH_32 : /home/site/wwwroot/newrelic/x86/libNewRelicProfiler.so
  • CORECLR_PROFILER_PATH_64 : /home/site/wwwroot/newrelic/libNewRelicProfiler.so
  • NEW_RELIC_APP_NAME : some app name
  • NEW_RELIC_LICENSE_KEY : license key
  1. Install NewRelic.Agent nuget package directly to the project which will be deployed. NewRelic folder must appear in project structure to make Agent work on production.

That’s all. Enjoy! : )

2 Likes

Awesome! Thanks so much for coming back to share that :smiley:

A post was split to a new topic: [.Net] File named libNewRelicProfiler.so in the x86 folder