Articles → MICROSOFT AZURE → Query The Log Analytics Workspace In Azure

Query The Log Analytics Workspace In Azure






Steps




  1. Create a virtual machine
  2. Create a log analytics workspace
  3. Connect the virtual machine to the log analytics workspace
  4. Create an agent configuration
  5. Query log analytics workspace



Create A Virtual Machine




Picture showing the virtual machine created in Azure portal
Click to Enlarge


Create A Log Analytics Workspace




Picture showing the log analytics workspace created in Azure portal
Click to Enlarge


Connect The Virtual Machine To The Log Analytics Workspace




Picture showing the virtual machines menu inside the log analytics workspace
Click to Enlarge



Picture showing the virtual machine in the disconnected state
Click to Enlarge



Picture showing the screen to connect a virtual machine with log analytics workspace
Click to Enlarge



Picture showing the virtual machine is connected to the load analytics workspace
Click to Enlarge


Create An Agent Configuration




Picture showing the agent configuration section for selecting the type of event to be logged
Click to Enlarge



Picture showing Application is selected as Log Name
Click to Enlarge




Query Log Analytics Workspace




New-EventLog -LogName Application -Source ‘Gyansangrah’

Write-EventLog -LogName Application -EventID 2001 -EntryType Warning -Source ‘Gyansangrah’ -Message ‘How are you Gyan?’




Event


Picture showing the events logged in log analytics workspace
Click to Enlarge




How To Search A String In The Table?




Event 
| search "manager"




Picture showing how to search a string in the result using the Search statement
Click to Enlarge


Posted By  -  Karan Gupta
 
Posted On  -  Thursday, June 9, 2022
 
Updated On  -  Monday, June 13, 2022

Query/Feedback


Your Email Id
 
Subject
 
Query/FeedbackCharacters remaining 250