Skip to content

Commit 79dea04

Browse files
committed
new article
1 parent 3c45e00 commit 79dea04

File tree

1 file changed

+59
-0
lines changed

1 file changed

+59
-0
lines changed
Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
1+
---
2+
title: Functions Azure Log Analytics | Microsoft Docs
3+
description: This article provides a tutorial for using the Analytics portal to write queries in Log Analytics.
4+
services: log-analytics
5+
documentationcenter: ''
6+
author: bwren
7+
manager: carmonm
8+
editor: ''
9+
ms.assetid:
10+
ms.service: log-analytics
11+
ms.workload: na
12+
ms.tgt_pltfrm: na
13+
ms.devlang: na
14+
ms.topic: conceptual
15+
ms.date: 08/16/2018
16+
ms.author: bwren
17+
ms.component: na
18+
---
19+
20+
21+
# Using functions in Azure Monitor Log Analytics
22+
23+
> [!NOTE]
24+
> You should complete [Get started with the Analytics portal](get-started-analytics-portal.md) and [Getting started with queries](get-started-queries.md) before completing this lesson.
25+
26+
[!INCLUDE [log-analytics-demo-environment](../../../includes/log-analytics-demo-environment.md)]
27+
28+
## Functions
29+
You can save a query with a function alias so it can be referenced by other queries. For example, the following standard query returns all missing security updates reported in the last day:
30+
31+
```Kusto
32+
Update
33+
| where TimeGenerated > ago(1d)
34+
| where Classification == "Security Updates"
35+
| where UpdateState == "Needed"
36+
```
37+
38+
You can save this query as a function and give it an alias such as _security_updates_last_day_. Then you can use it in another query to search for SQL-related needed security updates:
39+
40+
```Kusto
41+
security_updates_last_day | where Title contains "SQL"
42+
```
43+
44+
To save a query as a function, select the **Save** button in the portal and change **Save as** to _Function_. The function alias can contain letters, digits, or underscores but must start with a letter or an underscore.
45+
46+
> [!NOTE]
47+
> Saving a function is possible in Log Analytics queries, but currently not for Application Insights queries.
48+
49+
50+
## Next steps
51+
See other lessons for using the Log Analytics query language:
52+
53+
- [String operations](string-operations.md)
54+
- [Date and time operations](datetime-operations.md)
55+
- [Aggregation functions](aggregations.md)
56+
- [Advanced aggregations](advanced-aggregations.md)
57+
- [JSON and data structures](json-data-structures.md)
58+
- [Joins](joins.md)
59+
- [Charts](charts.md)

0 commit comments

Comments
 (0)