.. _data_export_command_subscriber:

Subscriber data export command
------------------------------


.. index:: voss;voss export

.. _18.1-Patch-Bundle-3|EKB-924:
.. _12.5(1)|VOSS-225:
.. _19.1|VOSS-225:
.. _19.1.1|VOSS-473:
.. _20.1.1|EKB-5146:
.. _20.1.1|EKB-5475:

.. note::
   The command ``voss subscriber_data_export`` is equivalent to ``voss export group subscriber``.
 

.. important::

   * To optimize performance:
     
     * On a unified node topology, run and schedule the data export command from the *secondary* database server if possible.
     * On a modular topology, run and schedule the data export command from any *application* server.
   * Since a data export can take time, the ``voss subscriber_data_export``
     and ``voss export`` commands can
     only be run in a ``tmux`` session. First run ``tmux`` and
     then ``voss export`` and its parameters. See also: 

     .. raw:: latex

        Using the tmux command in the Installation Guide

     .. raw:: html
  
        <a href="reference-tmux-command.html">Using the tmux command in the Installation Guide</a> 

   * Since the data export command runs database queries, it is recommended that the data exports be scheduled.
     Refer to the topic on scheduling for details and syntax.

     for example: 

     **schedule add subscriber_export voss export group subscriber**
     
     **schedule time subscriber_export weekly 1**
     
     Best practices for scheduling to consider, are:
     
     * Individual report exports should be scheduled in a serial manner so that they do not overlap and result
       in a high database load.
     * For resilience:
       
       * Stagger the schedule based on how long it is expected to run - in accordance with the number
         of subscribers in the database.
       * For better failover support, schedules can be created on all active Unified Nodes. This requires a more complex 
         schedule staggering and collection management. 
       * For simplified schedule staggering and the export collection management, schedules can be created and
         staggered on a single Unified Node. This option but requires a manual re-schedule in the case of node failover.


More than one parameter can be specified for the command
by prefixing them with the ``type`` parameter. For example: ``voss export type line site``

The ``type`` parameter values by ``subscriber`` group are listed below,
as well as a reference to the content details:

* ``analogue_line_mgcp`` (:ref:`analogue_line_MGCP_data_export`)
* ``analogue_line_sccp`` (:ref:`analogue_line_SCCP_data_export`)
* ``call_pickup_group``  (:ref:`call_pickup_group_data_export`)
* ``contact_center_enterprise`` (:ref:`contact_center_enterprise_data_export`)
* ``contact_center_express`` (:ref:`contact_center_express_data_export`)
* ``customer`` (:ref:`customer_data_export`)
* ``extension_mobility`` (:ref:`extension_mobility_data_export`)
* ``fmc`` (:ref:`FMC_data_export`)
* ``hunt_group`` (:ref:`hunt_group_data_export`)
* ``hybrid`` (:ref:`hybrid_data_export`)
* ``line`` (:ref:`line_data_export`)
* ``ms_o365`` (:ref:`mso365_data_export`)
* ``ms_teams`` (:ref:`ms_teams_data_export`)
* ``ms_exchange`` (:ref:`ms_exchange_data_export`)
* ``pexip_conference`` (:ref:`pexip_data_export`)
* ``phones`` (:ref:`phones_data_export`)
* ``site`` (:ref:`site_data_export`)
* ``subscriber`` (:ref:`subscriber_data_export`)
* ``voss_phone_servers`` (:ref:`phone_server_data_export`)
* ``webex_teams`` (:ref:`webex_teams_data_export`)

The export file directory and file format
of the ``subscriber`` group is:

* directory: ``media/data_export/<YYYY-MM-DD>``
* file naming format: ``<YYYY-MM-DD_HHMM>_<type>.json.gz``

For ``subscriber`` group files:

* A retention policy of 30 days is in place. After each successful
  extraction of the data, any extract files 31 days old or older will be removed.
* If an export contains no data, a JSON file will contain an empty JSON list: ``[]``.

Example:

``media/data_export/2018-10-11/2018-10-11_1236_analogue_line_sccp.json.gz``


Command examples:

* Single type

::

  $ voss export type line
  Starting line export, please wait...
  Completed line export, created 2018-10-11_1236_line.json.gz.


* Multiple types

::

   $ voss export type line site
   Starting line export, please wait...
   Completed line export, created 2024-05-07_0705_line.json.gz.
   Starting site export, please wait...
   Completed site export, created 2024-05-07_0706_site.json.gz.


* Group

  All types in a group are exported.

::

  $ voss export group subscriber
  Starting subscriber group export consisting of analogue_line_mgcp, analogue_line_sccp, [...]
  Starting analogue_line_mgcp export, please wait...
  Completed analogue_line_mgcp export, created 2018-10-11_1236_analogue_line_mgcp.json.gz.
  Starting analogue_line_sccp export, please wait...
  Completed analogue_line_sccp export, created 2018-10-11_1236_analogue_line_sccp.json.gz.
  [...]
  Completed subscriber group export.


The export files can then be copied to a remote system.
For example, from the Automate system, list out the data export files:

::

  $ ls media/data_export/2018-10-11
  2018-10-11_1236_analogue_line_sccp.json.gz

The exported files can be copied to a remote system using
SCP or SFTP on port 22. For example:

::

   remote_system:~$ scp <platform_user>@<voss_system>:media/data_export/2018-10-11/2018-10-11_1236_analogue_line_sccp.json.gz .



.. note::

   Contact your VOSS Account team for details regarding the reports obtained from the following commands:

   * ``voss export type nbi-subscriber`` (internal)
