Azure Log Analytics- Data Retention-1

Azure Log Analytics- Data Retention

Reading Time: 3 minutes

Log Analytics collects data from a variety of sources and uses a powerful query language to give you insights into the operation of your applications and resources.

Log Analytics cost depends on your choice of pricing tier, data retention and which solutions are used.

In this section lets see how we can increase and decrease the retention days for Log Analytics Workspace.

Steps for retention period.

Step 1: Log into Azure Portal

Step 2: Navigate to Log Analytics Workspace ( select your workspace)

Step 3: And under General>> Click Usage and estimated costs.

Step 4: Under usage and estimated cost select data retention.

Data retention by default is set as 30 days you can change according to your need.

Note: Retention for Application insight data types default to 90 days and will get the workspace retention if it is over 90 days.

Step 5: Click on Ok to save the changes

If you want to set the different retention per table, then follow the below steps.

Important elements to be considered when dealing with data retention

  • Changing the retention at workspace level will change the table retention any longer on the one previously modified
  • For this you will need to use some simple ARM commands.
  • To continue we need to know the resource id first to retrieve the Log analytics workspace resource id.
  • To get that id navigate to resource explorer
  • Under resource explorer
  • Select your subscription and then select resource group

Once you get the resource explorer click on subscription and then navigate all the resources till the one you want to operate on

Now that we have the workspace resourceid, you just need to add the table name and API information to run the necessary command.

By running the GET command throughARMClient, passing the resource id

ARMClient.exe get “/subscriptions/9df78e42-893b-4152-b04ff80674a99c67/resourceGroups/SmartAppsCOM-rg/
providers/Microsoft.OperationalInsights/workspaces/sa-production-loganalytics/Tables/AzureDiagnostics?api-version=2017-04-26-preview”

Now when we get the retention period we can set the retention according to our need by below ARM command

ARMClient.exe put “/subscriptions/9df78e42-893b-4152-b04f-f80674a99c67/
resourceGroups/SmartAppsCOM-rg/providers/Microsoft.OperationalInsights/workspaces/sa-production-loganalytics/tables/InsightsMetrics?api-version=2017-04-26-preview” “{‘properties’:{‘retentionInDays’:7}}”

But if you want to set it back. You can use null value. Use below command

ARMClient.exeput”/subscriptions/9df78e42-893b-4152-b04f-f80674a99c67/resourceGroups/SmartAppsCOM-rg/providers/Microsoft.OperationalInsights/workspaces/sa-production-loganalytics/Tables/InsightsMetrics?api-version=2017-04-26-preview” “{‘properties’:{‘retentionInDays’:null}}”

We are done with the retention period

5/5
Share on facebook
Share on twitter
Share on linkedin
Share on google
Share on whatsapp
Share on email
DOWNLOAD SOURCE CODE FOR FREE
MicrosoftTeams-image (32)

Azure DevOps Self Hosted Build Agents

Reading Time: 4 minutes

Agent is a server with the appropriate Operating System and the tools installed and configured.

Azure DevOps Supports below two agents :

  • Microsoft agents – These Agents are totally manages by azure
  • Self-Hosted Agents – These agents are configured by the user according to their needs.

Steps To configure Self Hosted Agents

In this Section We will see how to configure a self hosted agent for Windows And Linux VM

Creating a Personal Access Token (PAT)

Before We start configuring agents we need to create a PAT token.

Step 1. Login to Azure DevOps organization, open user settings, and select “Personal access tokens”

Step 2. In Personal Access Token Page, click on new token to Create the new token

Step 3. Provide the details Name of the token Expiration Date and permissions to this token

Note: Make sure to give full access for pipelines

Step 4. Once the token is generated, save it and use it in configuring agents.

Installing & configuring the agents

We have created the token so now we can start configuring the self hosted agents

Below are the steps to create a self hosted agents

Step 1. Navigate to the organization setting and then click on Agents pools.

Step 2. Select the Default Pool or You can create your own pool By clicking Add Pool

Step 3. Now Click on new agent and follow the steps mentioned in that

Step 4. You can select the desired operating system also

Windows Installation

Step 1. First Download the agent it will create a zip file

Step 2. Now extract the zip file to the target location( it is recommended to save in C: drive)

# Create directory and navigate to the directory

New-Item -Path “C:” -Name “agents” -ItemType “directory”

Set-Location -Path “C:agents”

# Extract the downloaded zip file

Add-Type -AssemblyName System.IO.Compression.FileSystem ; [System.IO.Compression.ZipFile]::ExtractToDirectory(“C:vsts-agent-win-x64-2.195.1.zip”, “$PWD”)

# Verify the extraction

Get-ChildItem

Step 3. Start configuring the agent by below command

.config.cmd

It will ask you some question which are mentioned below

  • Enter the URL: https://dev.azure.com/{your-organization}
  • Enter the authentication type (press enter for PAT) – Press enter for this step.
  • Enter personal access token. – Paste the PAT generated earlier
  • Enter Agent Pool – Press Enter if you are creating an agent in the default Agent pool, otherwise, provide the name of the Agent Pool
  • Enter Agent Name – Provide the Agent Name
  • Enter run agent as Service – Press Y for this in order to install & Run the Agent as a service in the Virtual Machine.

Step 4. Now Go back to the agent pool and now you can see the agent under the pool

Linux Installation

Installing and configuring the pipeline agent in Linux is similar to Windows. So, here we can see how to install Linux Agent

Step 1. Download the agent

wget https://vstsagentpackage.azureedge.net/agent/2.195.1/vsts-agent-linux-x64-2.195.1.tar.gz

Step 2. Create a folder and extract the downloaded tar.gz file.

# Create directory and navigate to the directory

mkdir agent

cd agent

# Extract the downloaded zip file

tar zxf ~/Downloads/vsts-agent-linux-x64-2.195.1.tar.gz

# Verify the extraction

ls

Step 3. Start configuring the giving below command

./config.sh

Similar to Windows configuration, the users will be asked to enter the server details, authentication type, and the authentication token we created earlier. Then configure the agent details, and finally, the user can start the agent by running the run.sh script.

Step 4 (Optional). You can configure the agent to run as a system service using the svc.sh script located in the agent directory. Specify the user and use the install command to configure the service.

sudo ./svc.sh install [user name]

sudo ./svc.sh start

Step 5. Now go back to the agent Pool and under this pool you will get the agent running

5/5
Share on facebook
Share on twitter
Share on linkedin
Share on google
Share on whatsapp
Share on email
DOWNLOAD SOURCE CODE FOR FREE