Configuration
Configuration File Path
-
Windows
The configuration file "TingYun.ini" is located in the Agent installation path. The default path is usually "C:\Program Files (x86)\Networkbench.COM\NetCore Profiler".
-
Linux
The configuration file is located at "./lib/tingyun-dotnet/TingYun.ini" in the Agent installation path.
- Root installation: The installation path is "/usr/".
- Non-root installation: The installation path is the folder specified by the user.
License Management
nbs.license: Associated with your account. The data collected by the Agent will be uploaded to the account bound to the license key.
Application Naming
By default, the application name displayed in the report is the project name of the .NET Core application.
If you want to name the application differently, please set the environment variable TINGYUN_APP_NAME before enabling the Agent.
Naming on Windows
set TINGYUN_APP_NAME=custom_name
call <installation_path>\tingyun-enable.bat
Naming on Linux
export TINGYUN_APP_NAME=custom_name
. <installation_path>/bin/tingyun-enable
Log Management
Log File Path
-
On Windows, the log files are located in the "log" folder under the Agent installation path. The default path is usually "C:\Program Files (x86)\Networkbench.COM\NetCore Profiler".
-
On Linux, the log file path depends on the installation permissions.
- Root installation: The path is "/var/log/tingyun/".
- Non-root installation: The path is
"/<installation_path>/log/"specified by the user.
Log Level
nbs.agent_log_level=INFO
Values: "OFF", "CRITICAL", "ERROR", "WARNING", "INFO", "VERBOSE", "DEBUG".
This option controls the log level for writing data to the log file. "DEBUG" is the lowest level, allowing all log information to be written. "OFF" is the highest level, disabling all log output.
Audit Mode
nbs.audit_mode=false
Values: true / false.
This option determines whether to write all data uploaded to and downloaded from the Tingyun platform to the log file.
User Tracing
Supports obtaining user information from custom embedded parameters or return values, HTTP request headers, HTTP response headers, URL parameters, form data in the body, Session, and Cookie.
Log Tracing
Prerequisites
- Agent version 3.3.2.0 or above
- log4net version 2.0.8 or above
- Log tracing switch enabled in the Tingyun platform
- Configure the monitored application's log4net configuration file
Configure log4net
Add [%property{TINGYUN}] to the conversionPattern.
The generated logs include:
- tingyun.app_id: A unique ID generated for each monitored application and microservice.
- tingyun.trace_id: A unique identifier for the entire request chain, generated by the entry transaction. This value is passed along the entire chain (except for components that cannot implement cross-application tracing), enabling full-link tracing. All logs involved in the call chain will show the same tingyun.trace_id.
- tingyun.span_id: A unique identifier generated for each application's request involved in the request chain. Each request in the application log will show a different tingyun.span_id.
Example Configuration
Please adapt the configuration as needed for your application.
For example, the original configuration:
<log4net>
<appender name="RollingFile" type="log4net.Appender.RollingFileAppender">
<file value="g:\tmp\async-mvc.log" />
<appendToFile value="true" />
<param name="Encoding" value="UTF-8"/>
<maximumFileSize value="100KB" />
<maxSizeRollBackups value="2" />
<layout type="log4net.Layout.PatternLayout">
<conversionPattern value="%d [%-5p] [%t] [%c] %m %n" />
</layout>
</appender>
<root>
<level value="ALL" />
<appender-ref ref="RollingFile" />
</root>
</log4net>
Change the conversionPattern to:
<conversionPattern value="%d [%-5p] [%t] [%c] [%property{TINGYUN}] %m %n" />
The resulting log will look like:
2021-12-29 14:27:18,278 [INFO ] [7] [Test]
[tingyun.app_id:6318,tingyun.trace_id:74a09a3218129fa3,tingyun.span_id:74a09a3218129fa3] this is a message