I am using DataDog 7.55.3 to write logs inside a local log file. The logs perfectly have been sent to our server that is installed, configured and provided by our Devops team... I tried to write the same logs into a local file log. However, no logs are written in local file.
According to the dataDog documentation and other resources, I create a folder with the name service.d inside the conf.d folder, I create conf.yaml file, I add following configs to the file
logs:
- type: file
path: "C:\\AppLogs.log"
service: "service"
source: "csharp"
auto_multi_line_detection: true
I created the C:\AppLogs.log file with a full access to ddagent user...
Status page of the agent shows me the correct setup of file Log Agent:
service
Type: file
Path: C:\AppLogs.log
Service: service
Source: csharp
Status: OK
Inputs:
C:\AppLogs.log
Bytes Read: 0
Pipeline Latency:
Average Latency (ms): 0
24h Average Latency (ms): 0
Peak Latency (ms): 0
24h Peak Latency (ms): 0
However, using LogFactory.LogInfo, the logs were collected into the server and are visible there, but they were not collected in file log.
The configuration you've posted is for having the agent read logs from the specified file, not write to it. Per the docs,
To gather logs from your <APP_NAME> application stored in <PATH_LOG_FILE>/<LOG_FILE_NAME>.log create a <APP_NAME>.d/conf.yaml file at the root...
Writing logs to that file would be dependent on configuring the logger in your application. This question and associated answers may help.