Forum Discussion
Azure not collecting custom log data
- May 29, 2019
Hi, found the problem.
my VM network settings are blocking both inbound and outbound internet connection, which making the agent cannot collecting my custom log.
for people who having the same problem this work out for me:
1. set a proxy server for your VM to connect to the internet.
2. connect your VM to that proxy server
3. set up your agent to also connect using those proxy
and monitor will collect custom log normally.
CliveWatson thanks a lot for your help mate, appreciate it!
regards,
I changed the encoding of the log txt file to UTF-8 and it started capturing the logs in Azure monitor via Log Analytics workspace (via monitoring agent).
These are the steps followed.
1) From the Log Analytic Workspace > Virtual Machines > Activated the workspace by 'Connect' option. This will install Microsoft Monitoring agent in the VM and register with this Log analytics workspace Id. ( see this by Login to VM and Control panel > Microsoft Monitoring agent > Azure Log Analytics (OMS) )
2) Then from Log analytics workspace > Custom Logs > Add log > follow the steps.
No need of (inbound outbound 443 https rules
No need of dependency agent to be enabled.
Within 10 to 15 minutes logs start the capturing.
Log file creation,
$logfilepath=$MyInvocation.MyCommand.Path -replace '\.ps1$', '.txt'
function WriteToLogFile ($message)
{
(Get-Date).ToString() + " : " + $message | Out-File $logfilepath -Append -Encoding utf8
}