skip to Main Content

How can I export logs from Azure in JSON format? and what is the best practicee to do that?

There is the option to use direct Kusto queries and export the logs to CSV, but in this case there is no JSON object export option.

2

Answers


  1. You can use the Diagnostic settings to create a continuous export of selected telemetry to for example a storage account:

    enter image description here

    The telemetry will be stored a json in blobs when you use a storage account as export destionation. See the docs for more detail regarding the export to blob storage.

    Login or Signup to reply.
  2. I do agree with @Peter Bons, But if you already exported the data as CSV you can follow below powerShell commands to change it into Json Objects:

    $csv = "C:UsersDownloadsquery_data.csv"
    $json= "C:UsersDownloadsquery_data1.json"    
    $csvD = Import-Csv -Path $csv
    $jsonD = ConvertTo-Json -InputObject $csvD -Depth 100
    Set-Content -Path $json -Value $jsonD
    

    enter image description here

    Firstly taken data and then converted it into json then posted that data into a json file.

    Output:

    enter image description here

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search