Skip to content

Instantly share code, notes, and snippets.

@ploegert
Created July 14, 2015 15:47
Show Gist options
  • Save ploegert/b984c0f04fd44c2ab258 to your computer and use it in GitHub Desktop.
Save ploegert/b984c0f04fd44c2ab258 to your computer and use it in GitHub Desktop.
READING LOGS
Let us say that I wish to check in detail that everything went well on my VM. How would I do that? I can log in to my VM from Azure and check the local logs. The files of interest to us will be the following two locations on VM hard drive:
C:\Packages\Plugins\Microsoft.Powershell.DSC\1.0.0.0
C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\1.0.0.0
You may find that your VM has a newer version of Powershell DSC extension,in which case the version number at the end of the path might be slightly different.
“C:\Packages\Plugins\Microsoft.Powershell.DSC\1.0.0.0” contains the actual extension files. You generally don’t need to worry about this location. However, if an extension failed to install for some reason and this folder isn’t present, that is a critical issue.
Now let’s start digging into the logs: C:\WindowsAzure\Logs. This folder contains general Azure logs that were captured for us. If for some reason DSC extension failed to deploy or there was some general infrastructure error, it would appear here under log files “WaAppAgent.*.log”
The lines of interest in these files are as follows. Note that your log may look slightly different.
[00000003] [07/28/2014 23:57:33.02] [INFO] Beginning installation of plugin Microsoft.Powershell.DSC.
[00000003] [07/28/2014 23:59:47.25] [INFO] Successfully installed plugin Microsoft.Powershell.DSC.
[00000009] [07/29/2014 00:02:51.02] [INFO] Successfully enabled plugin Microsoft.Powershell.DSC.
[00000009] [07/29/2014 00:02:51.03] [INFO] Setting the install state of the handler Microsoft.Powershell.DSC_1.0.0.0 to Enabled
Now we know that DSC extension was successfully installed and enabled. We continue our analysis by going to DSC extension logs. “C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\1.0.0.0” contains various logs from DSC extension itself.
PS C:\> PS C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\1.0.0.0> dir
Directory: C:\WindowsAzure\Logs\Plugins\Microsoft.Powershell.DSC\1.0.0.0
Mode LastWriteTime Length Name
---- ------------- ------ ----
-a--- 7/29/2014 12:28 AM 1613 CommandExecution.log
-a--- 7/28/2014 11:59 PM 1429 CommandExecution_0.log
-a--- 7/29/2014 12:01 AM 2113 CommandExecution_1.log
-a--- 7/29/2014 12:02 AM 1613 CommandExecution_2.log
-a--- 7/29/2014 12:28 AM 13744 DSCBOOT_script_20140729-002759.log
-a--- 7/29/2014 12:03 AM 473528 DSCLOG_metaconf__20140729-000322.json
-a--- 7/29/2014 12:28 AM 713196 DSCLOG_metaconf__20140729-002823.json
-a--- 7/29/2014 12:03 AM 608050 DSCLOG__20140729-000311.json
-a--- 7/29/2014 12:28 AM 713196 DSCLOG__20140729-002826.json
As you can see there are a number of various logs present.
“CommandExecution*.log” are logs written by Azure infrastructure as it enabled the DSC extension.
“DSCBOOT_script*.log” is a high level log that applied our configuration that we mentioned previously. It is fairly concise. If everything went well towards the end of the log you should be able to see a line such as this:
VERBOSE: [EXAMPLE-1] Configuration application complete.
If we wish to dig deeper into DSC logs, then the rest of logs can tell us much deeper story. “DSCLOG_*.json” logs are ETL DSC logs converted to JSON format. If configuration has completed successfully you should be able to see an event like this one:
{
"EventType": 4,
"TimeCreated": "\/Date(1406593703182)\/",
"Message": "[EXAMPLE-1]: LCM: [ End Set ] in 14.1745 seconds.",
“DSCLOG_metacong*.json” are the logs for your configuration if your PowerShell DSC configuration had a meta-config that modified PowerShell DSC properties, such as this:
LocalConfigurationManager
{
ConfigurationID = "646e48cb-3082-4a12-9fd9-f71b9a562d4e"
RefreshFrequencyMins = 23
}
You would see a similar event if meta configuration was applied successfully.
{
"EventType": 4,
"TimeCreated": "\/Date(1406593703182)\/",
"Message": "[EXAMPLE-1]: LCM: [ End Set ] in 14.1745 seconds.",
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment