{
    "id": "f30098e2-c8d5-4cc7-8ba2-94993a5d0830",
    "name": "Write Log Analytics Queries",
    "slug": "write-log-analytics-queries",
    "status": "published",
    "lab_type": "pta",
    "is_sample": false,
    "duration_in_seconds": 1800,
    "metadata": {
        "courses": [
            "1d0c3874-1dec-4abd-90aa-f5cbf362c035",
            "bdbadde2-fe15-49c9-b700-c0c8873eb04f"
        ],
        "pta_sdn": "142",
        "pta_namespace": "my.ine",
        "learning_paths": [],
        "has_published_parent": true
    },
    "session": null,
    "company": "a491bc32-c056-4946-9169-cc053387bada",
    "created": "2022-10-07T18:29:26.496114Z",
    "modified": "2023-10-03T18:59:10.196595Z",
    "is_beta": false,
    "lab_objectives": [],
    "main_learning_area": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
    "learning_areas": [
        {
            "id": "d3f82c70-f4e7-428e-afd7-4b1d28988e18",
            "name": "Cloud",
            "slug": "cloud"
        }
    ],
    "categories": [],
    "tags": [],
    "difficulty": null,
    "is_web_access": true,
    "is_lab_experience": false,
    "is_featured": false,
    "cve": null,
    "severity": null,
    "year": null,
    "classification": null,
    "is_trackable": false,
    "cpe_credits": null,
    "is_skill_check": false,
    "external_url": "",
    "solution_video": null,
    "explanation_video": null,
    "description": "Construct log analytics query in log analytics workspace running in an emulated Azure environment.",
    "description_html": "<p>Construct log analytics query in log analytics workspace running in an emulated Azure environment.</p>",
    "tasks": "",
    "tasks_html": "",
    "published_date": "2020-04-07T18:00:00Z",
    "solutions": "Analyze virtual machine performance\n\nWhen you log in to Azure with the provided credentials, you will find an empty resource group. \n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/1.png)\n\nThis lab uses the Log Analytics demo environment, which includes plenty of sample data that supports the sample queries.\n\nNavigate to the Log Analytics demo environment using the following URL.\n\n```\nhttps://portal.azure.com/#view/Microsoft_Azure_Monitoring_Logs/DemoLogsBlade\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/2.png)\n\nConstruct a log analytics query that returns the following information:\n\n- Average Processor Queue Length performance counter data.\n- Aggregated every 30 seconds over the last hour.\n- Grouped by ComputerName.\n\nCopy and paste the log analytics query and click on **Run** by selecting the whole query.\n\n```\nPerf\n| where TimeGenerated > ago(1h)\n| where (CounterName == \"% Processor Time\" and InstanceName == \"_Total\")\n| project TimeGenerated, Computer, CounterValue\n| summarize avg(CounterValue) by Computer, bin(TimeGenerated, 1m)\n| where avg_CounterValue > 100\n| render timechart\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/3.png)\n\nTo view the results in a graph, select **Chart** on the results pane. Notice that there are various options for working with the chart, such as changing it to another type.\n\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/4.png)\n\nClick on **Results** to view query results in a table organized by columns and rows.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/5.png)\n\n# Search for diagnostic events\n\nConstruct a log analytics query that returns the following information:\n\n- Returns the computers with the most entries from the Event and SecurityEvent sources that contain the word \"Antimalware\".\n\nCopy and paste the log analytics query and click on **Run** by selecting the whole query.\n\n```\nsearch in (Event, SecurityEvent) \"Antimalware\"\n| summarize count(Computer) by Computer\n| top 10 by count_Computer desc nulls last\n```\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/6.png)\n\nThe result will provide the details about the computer and the count of computers.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/7.png)\n\nClick on **Chart** to display the results as a chart.\n\n![](https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/8.png)\n\nOur lab is now completed.",
    "solutions_html": "<p>Analyze virtual machine performance</p>\n<p>When you log in to Azure with the provided credentials, you will find an empty resource group. </p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/1.png\" /></p>\n<p>This lab uses the Log Analytics demo environment, which includes plenty of sample data that supports the sample queries.</p>\n<p>Navigate to the Log Analytics demo environment using the following URL.</p>\n<pre class=\"codehilite\"><code>https://portal.azure.com/#view/Microsoft_Azure_Monitoring_Logs/DemoLogsBlade</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/2.png\" /></p>\n<p>Construct a log analytics query that returns the following information:</p>\n<ul>\n<li>Average Processor Queue Length performance counter data.</li>\n<li>Aggregated every 30 seconds over the last hour.</li>\n<li>Grouped by ComputerName.</li>\n</ul>\n<p>Copy and paste the log analytics query and click on <strong>Run</strong> by selecting the whole query.</p>\n<pre class=\"codehilite\"><code>Perf\n| where TimeGenerated &gt; ago(1h)\n| where (CounterName == \"% Processor Time\" and InstanceName == \"_Total\")\n| project TimeGenerated, Computer, CounterValue\n| summarize avg(CounterValue) by Computer, bin(TimeGenerated, 1m)\n| where avg_CounterValue &gt; 100\n| render timechart</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/3.png\" /></p>\n<p>To view the results in a graph, select <strong>Chart</strong> on the results pane. Notice that there are various options for working with the chart, such as changing it to another type.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/4.png\" /></p>\n<p>Click on <strong>Results</strong> to view query results in a table organized by columns and rows.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/5.png\" /></p>\n<h1>Search for diagnostic events</h1>\n<p>Construct a log analytics query that returns the following information:</p>\n<ul>\n<li>Returns the computers with the most entries from the Event and SecurityEvent sources that contain the word \"Antimalware\".</li>\n</ul>\n<p>Copy and paste the log analytics query and click on <strong>Run</strong> by selecting the whole query.</p>\n<pre class=\"codehilite\"><code>search in (Event, SecurityEvent) \"Antimalware\"\n| summarize count(Computer) by Computer\n| top 10 by count_Computer desc nulls last</code></pre>\n\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/6.png\" /></p>\n<p>The result will provide the details about the computer and the count of computers.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/7.png\" /></p>\n<p>Click on <strong>Chart</strong> to display the results as a chart.</p>\n<p><img alt=\"\" src=\"https://assets.ine.com/content/labs/azure-course-labs/write-log-analytics-queries/8.png\" /></p>\n<p>Our lab is now completed.</p>",
    "flags": [],
    "min_points_to_pass": null,
    "access_type": "web",
    "user_status": "unstarted",
    "user_lab_status": null,
    "user_status_modified": null,
    "user_flags": [],
    "global_running_session": null
}