Starting with Log Analytics: Part 6 - Creating a lab by importing a CSV with fake data
In this post we will see a way to create a Log Analytics lab by creating a CSV with data and import them into Log Analytics.
Context
- You want to test Log Analytics
- You want to import wrong data to play with
- You don't want to import data from devices
Our data lab
We will first create a CSV with wrong data.
In this example our CSV will be as below:
Get the lab
Click on the below GitHub picture to download both CSV and PS1.
Import data to Log Analytics
Required information
The first step is to get information from your Log Analytics workspace
For our need, below information are required:
- Workspace ID
- Primary key
- Name of the log to create or update
You can find both Workspace ID and primary key in the Agents management part:
Importing data
We will configure some variables with Log Analytics info and also the Custom Log to create.
$CustomerId = <Your Log Analytics Workspace ID>
$Custom_Logs = "<Custom Log name>"
$SharedKey = <Your Log Analytics SharedKey>
The Custom Log will be created the first time if not exists.
All data will be implemented into this Custom Log.
To import data from the CSV we will use the below script:
It will automatically import data from the CSV into the Custom Log.
Viewing data in Log Analytics
Once you have executed the script wait a bit and a new Custom Log will be created.
We will then create a quick workbook, just listing data:
1. Go to Workbooks
2. Click on New
3. Remove the default query
4. Click on Add > Add query
5. Type below query
6. See result below
6. Click on Done editing
7. See below the result
What's next ?
In the next post we will see how to make a workbook better by adding:
- Tab
- Combo box
- Cool grid with filter
- Pie chart
Enregistrer un commentaire