a94e7f3db7
Bumps [Azure.Identity](https://github.com/Azure/azure-sdk-for-net) from 1.5.0 to 1.10.2. - [Release notes](https://github.com/Azure/azure-sdk-for-net/releases) - [Commits](https://github.com/Azure/azure-sdk-for-net/compare/Azure.Identity_1.5.0...Azure.Identity_1.10.2) --- updated-dependencies: - dependency-name: Azure.Identity dependency-type: direct:production ... Signed-off-by: dependabot[bot] <support@github.com> |
||
---|---|---|
.. | ||
SampleDataIngestTool | ||
ReadMe.md |
ReadMe.md
Sample Data Ingest Tool
Author: Chi Nguyen
Description
This repository contains a tool in C# console application that allows users to post sample data of custom format to their Azure Log Analytics Custom logs. The sample data is found in Custom folder under Sample Data directory. The posted data can then be accessed via their Azure Log Analytics Custom logs or Azure Sentinel Custom Log table.
Two options are available using the tool. The Prerequisites and App Registration steps are required for both options.
Prerequisites
To configure the tool, the following assembly is required to post sample data to Azure Log Analytics custom logs via Azure Monitor Http Data Collector API.
-
Active Azure Subscription, if you don't have one, create a free account before you begin.
-
[Optional] Obtain domain by following these steps:
- Login into Azure Management Portal
- Navigate to the Azure Active Directory blade
- Click on Custom Domain Names. Copy your domain name as you will need it later to run the application.
-
Log Analytics workspace. If you don't have one, create a Log Analytics workspace.
-
Obtain WorkSpaceId and PrimaryKey following these steps. Copy this workspace Id and PrimaryKey as you will need them later to run the application.
- In the Azure portal, search for and select Log Analytics workspaces
- In your list of Log Analytics workspaces, select the workspace you intend on configuring the agent to report to.
- Select Agents management. Copy the
Workspace ID
, and thePrimary Key
. They are set as theworkspaceId
andsharedKey
.
-
To enable Azure Sentinel, you need contributor permissions to the subscription in which the Azure Sentinel workspace resides. Learn more to onboard Azure Sentinel.
-
To use Azure Sentinel, you need either contributor or reader permissions on the resource group that the workspace belongs to.
-
.NET Core installed locally.
App Registration
To use Log Analytics API in the application, you'll need to register a new application in the Microsoft Application Registration Portal. Follow these steps to register a new application:
-
Sign in to the Application Registration Portal using either your personal or work or school account.
-
Choose New registration.
-
Enter an application name, and choose Register (keep the default values for the other fields).
-
Next you'll see the overview page for your app. Copy and save the Application Id (clientId) field. You will need it later to complete the configuration process as the
clientId
. If the app is not registered under the domain listed above, you will also need to copy and save the Directory ID (tenantId). -
Under Certificates & secrets, choose New client secret and add a quick description. A new secret will be displayed in the Value column. Copy this password. You will need it later to complete the configuration process (clientSecret) and it will not be shown again.
-
Link Log Analytics workspace to your registered application by following these steps:
- Navigate to your Azure portal, and select or search for Log Analytics.
- Select your workspace from the list of available options, or search for it.
- From the left menu that opens, select Access Control (IAM). Click Add, and select Log Analytics Reader for the Role in the blade that appears. Search for your AAD App by name, and then click save.
- You app is now setup to make API calls to your workspace.
Option 1: Post sample log data
This option allows users to post the readily available sample custom data in the Sample Data directory to Azure Log Analytics Custom logs.
Setup
-
Clone Azure Sentinel repository by running this command: git clone https://github.com/Azure/Azure-Sentinel.git
-
In the cloned repo, navigate to the Tools directory, and open SampleDataIngestTool solution.
-
Install necessary dependencies: In Visual Studio, right click the SampleDataIngestTool solution. Click Restore NuGet Packages.
-
Open config.txt file, enter the following credentials using the information you've saved from the Prerequisites and App Registration section.
"workspaceId": "enter string, from Log Analytics workspace > Agents Management > Workspace ID", "sharedKey": "enter string, from Log Analytics workspace > Agents Management > Primary key", "clientId": "enter string, from App > Overview > Essentials > Application (client) ID", "clientSecret": "enter string, from App > Overview > Certificates & secrets > Secret Value", "domain": "enter string, from Azure AD";
-
Once changes are complete, save the file. Now you can run the application. Please note that the "Main" function in the Program.cs class is the entry point for the application.
- If it's the first time the application is run, all custom data files of json format are posted to the Log Analytics custom logs. Once the application finishes running, check the Console to see the names of the file that have been successfully pushed.
- In the next runs after the first run, you are asked to enter your response to a prompt in the Console. Enter your reponse (Yes/No) to indicate whether or not you'd like to post the sample data again.
- If the response is Yes, the sample data is pushed again to the Log Analytics custom logs.
- View the sample data in your Log Analytics Custom Logs or Azure Sentinel Custom Log.
Option 2: Post your own custom log data
This option allows users to post their own custom log data to Azure Log Analytics Custom logs.
Setup
- Follow step 1-4 from the Setup section under Option 1 above.
- In the Custom folder under Sample Data directory of the cloned repo, create a new file with your custom log data in a json format with a "_CL" suffix. For example, "testdata_CL.json" is a valid custom log file name.
- Follow step 5 from the Setup section under Option 1 above.
Contributing
This project welcomes contributions and suggestions. Most contributions require you to agree to a Contributor License Agreement (CLA) declaring that you have the right to, and actually do, grant us the rights to use your contribution. For details, visit https://cla.opensource.microsoft.com.
When you submit a pull request, a CLA bot will automatically determine whether you need to provide a CLA and decorate the PR appropriately (e.g., status check, comment). Simply follow the instructions provided by the bot. You will only need to do this once across all repos using our CLA.
This project has adopted the Microsoft Open Source Code of Conduct. For more information see the Code of Conduct FAQ or contact opencode@microsoft.com with any additional questions or comments.
Copyright
Copyright (c) 2020 Microsoft. All rights reserved.