# Audit Log API - How to Convert Json Data to Excel

**URL:** <https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919>\
**Category:** Dynatrace Tips\
**Tags:** reports, dynatrace-saas, tips-and-tricks\
**Created:** [January 17, 2020, 1:31pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919 "2020-01-17T13:31:38Z")\
**Posts on this page:** 10\
**Page:** 1

<div class="post-metadata">

**Author:** ![ChadTurner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/chadturner/32/161_2.png) [@ChadTurner](https://community.dynatrace.com/u/ChadTurner)\
**Post date:** [January 17, 2020, 1:31pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/1 "2020-01-17T13:31:38Z")

</div>

Many people have asked how to convert Json Files into Excel. Follow these simple stepson how to get started.

---

<div class="post-metadata">

**Author:** ![ctturner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ctturner/32/11883_2.png) [@ctturner](https://community.dynatrace.com/u/ctturner)\
**Post date:** [January 17, 2020, 1:54pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/2 "2020-01-17T13:54:14Z")

</div>

First and foremost you will need to have enabled SaaS audit logging and created an API token that will authorize the audit log Json data. These instruction can be found here: [Setting up SaaS Audit Logs](https://answers.dynatrace.com/spaces/482/dynatrace-open-qa/questions/233292/dynatrace-saas-audit-logs.html)

**1.)** Once you have run the API to capture the data it will then allow you to download this data in the form of a json File: Click Download. The file will then download on your device.

 ![23281-step-1.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/d/bdd9a9ddce136cdb097babfaab494580a00317fb.png)

**2.)** Open up excel and select Data \> Get Data \> From File \> From JSON. Browse and open the recently downloaded Json File

 ![23282-step-2.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/6/d69a2f21905977a2b15847bb1096044110e2cc9d.png)

**3.)** Here we can see that there are 156 entries. lets go ahead and click the list.

 ![23283-step-3.png](https://global.discourse-cdn.com/dynatrace/original/2X/8/89a7fb02f20c5bb83be568e2c7e9896be72890d8.png)

**4.)** You will now see all the records that were in that list that make sup the audit log. To break these out of the list we will need to select “To Table”.

 ![23284-step-4.png](https://global.discourse-cdn.com/dynatrace/original/2X/4/48fb80247300136e34e338743706a8d4bab40c9a.png)

**5.)** Keep the Defaults and select OK

 ![23285-step-5.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/d/fd7f9fe8c08ff9f160e7bd4ef94c2d4e7b2c93ef.png)

**6.)** the second part of the data break out is to Select the break out arrows, and select the columns you’d like to be included. These are the columns that are listed in the records. Selected them as desired.

 ![23286-step-6.png](https://global.discourse-cdn.com/dynatrace/original/3X/6/7/670f7bed55f2258ab6910350335cac059709beef.png)

**7.)** The data will then be broken out. Take this opportunity to move the columns around as you see fir. This can be done by right clicking a column and selecting move.

 ![23287-step-7.png](https://global.discourse-cdn.com/dynatrace/original/3X/d/9/d91c2d1e637593794e4d889be3878ac3d4429a51.png)

**8.)** You can also replace values. For example if you what to change the environment ID to Prod or NonProd you can do so by right clicking the column and selecting “Replace Values”.

 ![23288-step-8.png](https://global.discourse-cdn.com/dynatrace/original/2X/4/474976f4ff3808de46fe235cec2268c63853f3bf.png)

---

<div class="post-metadata">

**Author:** ![ctturner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ctturner/32/11883_2.png) [@ctturner](https://community.dynatrace.com/u/ctturner)\
**Post date:** [January 17, 2020, 1:54pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/3 "2020-01-17T13:54:25Z")

</div>

**9.)** Fill out the form as desired and select ok.

 ![23289-step-9.png](https://global.discourse-cdn.com/dynatrace/original/3X/b/3/b3280c1fb1885e4697e633b777c119dc36f9dd32.png)

**10.)** Once you are satisfied with the lay out, select Close and load. The data will now be imported into Excel.

 ![23296-step10.png](https://global.discourse-cdn.com/dynatrace/original/3X/1/3/1313d6f386249747a7b1e8a2a600ea85cefceba4.png)

**11.)** The results:

 ![23291-step-11.png](https://global.discourse-cdn.com/dynatrace/original/2X/a/a3da19fd0d26c4380de915f2f6bd5d0e8b80f209.png)  
 ![step10.png](https://global.discourse-cdn.com/dynatrace/original/2X/3/3ed73f9d44e0b9fdc3f4704f943a67531bc3528c.png)

---

<div class="post-metadata">

**Author:** ![larry\_roberts](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/larry_roberts/32/7131_2.png) [@larry\_roberts](https://community.dynatrace.com/u/larry_roberts)\
**Post date:** [January 17, 2020, 1:58pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/4 "2020-01-17T13:58:05Z")

</div>

Excellent post! Love tutorial contributions like this. Thank you!

---

<div class="post-metadata">

**Author:** ![ctturner](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/ctturner/32/11883_2.png) [@ctturner](https://community.dynatrace.com/u/ctturner)\
**Post date:** [January 17, 2020, 2:00pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/5 "2020-01-17T14:00:12Z")

</div>

Thank you! You are more then welcome! Happy to share my knowledge!

---

<div class="post-metadata">

**Author:** ![rodrigo\_alvare1](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/rodrigo_alvare1/32/1927_2.png) [@rodrigo\_alvare1](https://community.dynatrace.com/u/rodrigo_alvare1)\
**Post date:** [February 20, 2020, 5:36pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/6 "2020-02-20T17:36:21Z")

</div>

Additional to this just remember the options that we have to extract information from Dynatrace and read it in CSV format:

1) Use Environment API v1 + script that converts JSON to Excel  
- For this, you may extract the information you are interested in Timeseries endpoint. The request will return a JSON file.  
- Download the JSON returned  
- Use the script from [GitHub - HAtree/DtJsonToCsv · GitHub](https://github.com/HAtree/DtJsonToCsv) to convert the JSON in a CSV format

2) Use Environmental API v2  
- Extract information by using the Metrics endpoint and passint he header “accept: text/csv”, this will return the metric values in csv format  
Check this blog article for more details [Integrate Dynatrace more easily using the new Metrics REST API](https://www.dynatrace.com/news/blog/integrate-dynatrace-more-easily-using-the-new-metrics-rest-api/)  
(example of the call:  
curl -X GET “https://\<YOUR\_URL\>api/v2/metrics/query? metricSelector=builtin%3Aservice.response.time&resolution=m&from=-15m” -H “accept: text/csv; header=present; charset=utf-8” -H “Authorization: Api-Token \<YOUR\_TOKEN\>” )

---

<div class="post-metadata">

**Author:** ![Malaik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/malaik/32/32673_2.png) [@Malaik](https://community.dynatrace.com/u/Malaik)\
**Post date:** [July 11, 2021, 7:18am UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/7 "2021-07-11T07:18:40Z")

</div>

Thanks&nbsp;[@ChadTurner](https://community.dynatrace.com/user/14877)&nbsp;very helpful  
But Im in environment with Excel 2016, no way to find the option to import json file.

---

<div class="post-metadata">

**Author:** ![AntonioSousa](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/antoniosousa/32/50_2.png) [@AntonioSousa](https://community.dynatrace.com/u/AntonioSousa)\
**Post date:** [July 11, 2021, 9:56am UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/8 "2021-07-11T09:56:53Z")

</div>

You might want to use jq, like in the command below. I only use the entries below, but you can adapt to your own case. In my case, I also use TSV, as it’s better than CSV, as commas may appear elsewhere in the data.

jq -r “.auditLogs[]|[.eventType,.category,.entityId,.user,.userType,.userOrigin,.timestamp,.success,(.patch|@text)]|@tsv”

---

<div class="post-metadata">

**Author:** ![Malaik](https://dub1.discourse-cdn.com/dynatrace/user_avatar/community.dynatrace.com/malaik/32/32673_2.png) [@Malaik](https://community.dynatrace.com/u/Malaik)\
**Post date:** [July 11, 2021, 11:49am UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/9 "2021-07-11T11:49:14Z")

</div>

Thanks

But simply, you can select Data from Text file

Worked fine.

Great post.

---

<div class="post-metadata">

**Author:** ![andras\_kovacs03](https://avatars.discourse-cdn.com/v4/letter/a/3da27b/32.png) [@andras\_kovacs03](https://community.dynatrace.com/u/andras_kovacs03)\
**Post date:** [February 10, 2023, 8:44pm UTC](https://community.dynatrace.com/t/audit-log-api-how-to-convert-json-data-to-excel/22919/10 "2023-02-10T20:44:24Z")

</div>

Hi&nbsp;[@ctturner](https://community.dynatrace.com/user/15386),

great post, it works for most APIs, but it just doesn’t work for Cluster API v1 GET /groups/managementZones.

As I break out the mzPermissions coloumn, I get an error message:&nbsp;We cannot convert a value of type Record to type Text.

 ![andras_kovacs03_0-1676061746319.png](https://global.discourse-cdn.com/dynatrace/original/3X/f/4/f4bfcfcc50dd944f8f6eb99fb5b8dea35d27f341.png)

What am I doing wrong?

Can you reproduce the error on your side?
