You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
-[Custom table](../logs/create-custom-table.md) to send your logs to.
21
20
-[Permissions to create Data Collection Rule objects](../essentials/data-collection-rule-overview.md#permissions) in the workspace.
22
21
- A VM, Virtual Machine Scale Set, or Arc-enabled on-premises server that writes logs to a text file.
23
22
- The log file must be stored on the local drive of the machine on which Azure Monitor Agent is running.
24
23
- Each entry in the log file must be delineated with an end of line.
25
24
- The log file must not allow circular logging, log rotation where the file is overwritten with new entries, or renaming where a file is moved and a new file with the same name is opened.
26
25
26
+
## Create a custom table
27
+
28
+
This step will create a new custom table, which is any table name that ends in \_CL. Currently a direct REST call to the table management endpoint is used to create a table. The script at the end of this section is the input to the REST call.
29
+
30
+
The table created in the script has two columns TimeGenerated: datetime and RawData: string, which is the default schema for a custom text log. If you know your final schema, then you can add columns in the script before creating the table. If you do not, columns can always be added in the log analytics table UI.
31
+
32
+
The easiest way to make the REST call is from an Azure Cloud PowerShell command line (CLI). To open the shell, go to the Azure Portal, press the Cloud Shell button, and select PowerShell. If this is your first-time using Azure Cloud PowerShell, you will need to walk through the one-time configuration wizard.
33
+
34
+
35
+
Copy and paste the following script in to PowerShell to create the table in your workspace. Make sure to replace the {subscription}, {resource group}, {workspace name}, and {table name} in the script. Make sure that there are no extra blanks at the beginning or end of the parameters
36
+
37
+
```code
38
+
$tableParams = @'
39
+
{
40
+
"properties": {
41
+
"schema": {
42
+
"name": "{TableName}_CL",
43
+
"columns": [
44
+
{
45
+
"name": "TimeGenerated",
46
+
"type": "DateTime"
47
+
},
48
+
{
49
+
"name": "RawData",
50
+
"type": "String"
51
+
}
52
+
]
53
+
}
54
+
}
55
+
}
56
+
'@
57
+
58
+
Invoke-AzRestMethod -Path "/subscriptions/{subscription}/resourcegroups/{resourcegroup}/providers/microsoft.operationalinsights/workspaces/{WorkspaceName}/tables/{TableName}_CL?api-version=2021-12-01-preview" -Method PUT -payload $tableParams
59
+
```
60
+
61
+
Press return to execute the code. You should see a 200 response, and details about the table you just created will show up. To validate that the table was created go to your workspace and select Tables on the left blade. You should see your table in the list.
62
+
63
+
27
64
## Create data collection rule to collect text logs
0 commit comments