.. _export_a_transaction:

Export a Transaction
--------------------

.. _19.1.1|EKB-2:

Administrators can export upper level parent transactions. This will include their
child sub-transactions as well as the associated transaction log entries in JSON
format.

The exported files may also be requested by VOSS support operators for troubleshooting
purposes.

1. From the **Transaction** list view (default menu **Administration Tools > Transaction**), 
   select a parent transaction.
#. From the transaction details view, choose **Export** from the button bar.
   A ``.zip`` archive file is downloaded by the browser.


Transaction Export Files and Format
...................................


The ``.zip`` archive filename format: 
  
*export-tx-<Transaction ID>_<YYYY>-<MM>-<DD>T<HH_MM_SS>.json.zip*

Example:  ``export-tx-20705_2019-01-22T06_18_15.json.zip`` for parent transaction ID 20705.

The  ``.zip`` archive contains two files in JSON format:

* The Transaction Detail file - containing transaction (parent and sub-transaction)
  details as on the Admin Portal - upper level and **Sub Transactions** table entries
  in JSON format: 

  *export-tx-<Transaction ID>_<YYYY>-<MM>-<DD>T<HH>:<MM>:<SS>.json*

* The Transaction Log file - containing entries as on the table of **Log** entries
  of a transaction on the Admin Portal (up to 1000 entries) in JSON format: 
  
  *export-tx-logs-<Transaction ID>_<YYYY>-<MM>-<DD>T<HH>:<MM>:<SS>.json*


Transaction Detail File Format
..............................

The example snippet below shows transaction details data of the the upper level parent.

* Upper level parent entries are identified by the same ``pkid`` and ``top_level`` values,
  with ``"parent_pkid": null``.
* Child and descendant entries show different ``pkid`` and ``parent_pkid`` values. The tree
  of parent and child entries can be determined by inspecting these values.

::

   "processor_host_name": "VOSS-voss-queue",
   "pkid": "c0a03e99-0c93-4d85-8736-f05b54f8fe55",
   "hierarchy": "5c46a8efce894e001453b2a8",
   "submitted_time": "2019-01-22T06:18:15.804000Z",
   "started_time": "2019-01-22T06:18:15.839000Z",
   "detail": "[ 9\\/9 ] succeeded from [ 1 ] sheet in H2-5-VOSS4...
   "top_level": "c0a03e99-0c93-4d85-8736-f05b54f8fe55",
   "priority": "Normal",
   "duration": 3.187191,
   "submitter_host_name": "VOSS",
   "txn_seq_id": "20705", 
   "parent_pkid": null,
   "action": "Execute Bulk Load",
   "message": null,
   "completed_time": "2019-01-22T06:18:19.026000Z",
   "operation": "execute"


Transaction Log File Format
...........................

The snippet below has been formatted for readability.
The ``transaction_id`` in the two entries shown will correspond with
``pkid`` entries in the Transaction Detail file, so that the Log entries
can be associated with the transactions and sub-transactions.

::


   {
      "severity": "info",
      "format": "text",
      "log_id": "5c46b5a7ce894e0014569a0b",
      "time": "2019-01-22T06:18:15.871000",
      "message": "H2-5-VOSS4UC-HCS-Customer_Data_ClassOfService...
      "transaction_id": "c0a03e99-0c93-4d85-8736-f05b54f8fe55"
   },
   {
      "severity": "info",
      "format": "text",
      "log_id": "5c46b5abce894e0014569ab3",
      "time": "2019-01-22T06:18:19.012000",
      "message": "Summary for sheet: Sheet1, No errors",
      "transaction_id": "d7aa7333-f692-40b4-a637-80cf456c1f70"
   },