• /
  • Log in
  • Free account

Debugging the .NET Core Agent on Linux

Problem

After installing New Relic's .NET agent in Linux, you don't see any data, notice missing data, or don't see any logs.

Solution

Important

  • Make sure you have administrator privileges on your host to continue
  • Ensure that the installation and execution steps have been followed (installation guide)

Step 1: Check for agent logs of the application

Tip

  • If you installed the .NET Core agent, or installed either agent with the NewRelic.Agent NuGet package, you’ll find a logs folder in the directory where the agent was extracted on your system.
  • In some installation methods in linux, it defaults to /usr/local/newrelic-netcore20-agent
  1. Make sure you’re looking at current data. Delete or move any existing files in the logs directory so that you’re sure the logs you generate reflect the current state of your system.
  2. Restart your application.
  3. Exercise your application for at least one minute in a way that would generate traffic you’d expect to see in your New Relic account.
  4. Make note of the process ID (PID) your application is running under so you can verify if a log is being created for that process. You can find the PID by using either of the following commands via the command-line: pidof dotnet or pidof the_process_name.
  5. Go back to the agent logs directory and look for a log file with a name containing the process ID of your application, for example NewRelic.Profiler.[PID].log.
  6. If you see that profiler log file in the logs directory, then also check to see if there is a corresponding agent log.
  7. Look for another file with the prefix newrelic_agent. There may be more than one of these if you’re running multiple .NET applications on your host. If you see one or more you must determine which corresponds to the application you’re trying to monitor.
  8. Search in the agent log for the string (pid [your PID]), for example (pid 1573). If you find that string in the log file, then you know it is the agent log associated with your application.

Step 2: Check if the .NET Core agent profiler is loaded into the application’s process

In the console, execute the following, replacing pid with your process ID:

sudo cat /proc/PID/maps | grep "libNewRelicProfiler.so"

Based on the output, here's what you need to do:

  • If you don’t get any results from that command, continue to the next step.
  • If you get results, skip down to Step 4 (permissions).

Step 3: Check for the required environment variables:

Execute the following, replacing PID with your process ID.

args --null --max-args=1 < /proc/PID/environ | grep "CORECLR_"

Based on the output, here's what you need to do:

  • If you get no results, set your environment variables, restart your application, and go back to Step 1.
  • If you get results, make sure all four required variables are set and have valid values:
    • CORECLR_ENABLE_PROFILING: Must always be set to 1.
    • CORECLR_PROFILER: Must always be set to {36032161-FFC0-4B61-B559-F6C5D41BAE5A}.
    • CORECLR_NEWRELIC_HOME: Must be set to the fully qualified path to the .NET Core agent directory (the directory where newrelic.config, libNewRelicProfiler.so, and the extensions directory are located).
    • CORECLR_PROFILER_PATH: Must be set to the fully qualified path to the file libNewRelicProfiler.so. This is almost always equal to CORECLR_NEWRELIC_HOME + /libNewRelicProfiler.so.
  • If you made any changes to your environment variables, restart your app and go back to Step 1.

Step 4: Check permissions

Check the following permissions tasks:

  • Make sure that the user your application process is running under has read/write/execute permissions to directory where the .NET Core agent was extracted on your system (CORECLR_NEWRELIC_HOME), and all of its sub-directories.
  • If you made any changes, restart your app and go back to Step 1.

If the above steps did not address the issue, we recommend you contact support on ask for help in Explorers Hub.

For more help

If you need more help, check out these support and learning resources:

Create issueEdit page
Copyright © 2021 New Relic Inc.