.. highlight:: rst

.. _seedlink4:

#########
seedlink4
#########

**SeedLink4 server**


Description
===========

SeedLink4 implements the `FDSN SeedLink 4.0 <https://docs.fdsn.org/projects/seedlink/>`_ protocol and supports the `miniSEED 3 <https://docs.fdsn.org/projects/miniseed3/>`_ data format. SeedLink 3.x and miniSEED 2.x are also supported. The following applications are included:

seedlink4
    The SeedLink4 server
sl3plug
    An application that runs SeedLink plugins and feeds data to the server. All SeedLink 3.x plugins are supported.
chain4_plugin
    A version of chain_plugin that supports SeedLink4 and miniSEED 3.
slarchive4
    A version of slarchive that supports SeedLink4 and miniSEED 3.

Configuration
-------------
SeedLink4 does not have own bindings, but relies on "seedlink" bindings and plugin configuration created by the "seedlink" module. It does have own configuration file, seedlink4.cfg, which follows SeisComP conventions. If the configuration file does not exist, default settings are used.

SeedLink4 needs database connection for bindings and inventory (station desctiptions). New stations are added as soon as data is received, even if bindings and inventory does not exist.

If a working SeedLink 3.x configuration exists, a switchover to SeedLink4 can be done as follows:

* seiscomp stop seedlink
* seiscomp start seedlink4
* seiscomp start sl3plug

To support miniSEED 3, replace chain_plugin by chain4_plugin and slarchive by slarchive4. This can be done on a station-by-station basis (using bindings).


.. _seedlink4_configuration:

Module Configuration
====================

| :file:`etc/defaults/global.cfg`
| :file:`etc/defaults/seedlink4.cfg`
| :file:`etc/global.cfg`
| :file:`etc/seedlink4.cfg`
| :file:`~/.seiscomp/global.cfg`
| :file:`~/.seiscomp/seedlink4.cfg`

seedlink4 inherits :ref:`global options<global-configuration>`.



.. confval:: port

   Default: ``18000``

   Type: *int*

   TCP port for SeedLink connections. By default
   the SeedLink standard port 18000 will be used.


.. confval:: sslport

   Default: ``0``

   Type: *int*

   TCP port for encrypted \(SSL\) SeedLink connections.
   Disabled \(0\) by default.


.. confval:: certificate

   Type: *string*

   Location of SSL certificate file.


.. confval:: privateKey

   Type: *string*

   Location of SSL private key file.


.. confval:: filebase

   Default: ``@ROOTDIR@/var/lib/seedlink4``

   Type: *string*

   Location of storage.


.. confval:: segments

   Default: ``10``

   Type: *int*

   Number of segments per station. By default, 10 segments will be used.


.. confval:: segsize

   Default: ``1000``

   Type: *int*

   Segment size in records. By default, 1000 records will be used.


.. confval:: recsize

   Default: ``1024``

   Type: *int*

   Maximum record size in bytes, including metadata header. The default
   is 1024 bytes. Total size of the ringbuffer per station is
   segments\*segsize\*recsize. These parameters can be overridden on
   a station\-by\-station basis using seedlink bindings.


.. confval:: granularity

   Default: ``600``

   Type: *int*

   Time index granularity. Default is 600 seconds.


.. confval:: organization

   Default: ``Unconfigured``

   Type: *string*

   Data center description in HELLO response.


.. confval:: trusted

   Default: ``127.0.0.0/8``

   Type: *list:string*

   List of IP adresses and\/or usernames of clients who have FEED and
   INFO CONNECTIONS permission and full access to all stations
   regardless of the \"access\" setting.


.. confval:: access

   Type: *list:string*

   List of IP adresses and\/or usernames that can access stations by
   default. This can be overridden on a station\-by\-station basis using
   seedlink bindings. Empty means no access restrictions.


.. confval:: defaultNetwork

   Default: ``XX``

   Type: *string*

   Network code of uni\-station mode \(obsolete\).


.. confval:: defaultStation

   Default: ``XXX``

   Type: *string*

   Station code of uni\-station mode \(obsolete\).



Command-Line Options
====================

.. program:: seedlink4


Generic
-------

.. option:: -h, --help

   Show help message.

.. option:: -V, --version

   Show version information.

.. option:: --config-file file

   The alternative module configuration file. When this option
   is used, the module configuration is only read from the
   given file and no other configuration stage is considered.
   Therefore, all configuration including the definition of
   plugins must be contained in that file or given along with
   other command\-line options such as \-\-plugins.

.. option:: --plugins arg

   Load given plugins.

.. option:: -D, --daemon

   Run as daemon. This means the application will fork itself
   and doesn't need to be started with \&.


Verbosity
---------

.. option:: --verbosity arg

   Verbosity level [0..4]. 0:quiet, 1:error, 2:warning, 3:info,
   4:debug.

.. option:: -v, --v

   Increase verbosity level \(may be repeated, e.g., \-vv\).

.. option:: -q, --quiet

   Quiet mode: no logging output.

.. option:: --print-component arg

   For each log entry print the component right after the
   log level. By default the component output is enabled
   for file output but disabled for console output.

.. option:: --component arg

   Limit the logging to a certain component. This option can
   be given more than once.

.. option:: -s, --syslog

   Use syslog logging backend. The output usually goes to
   \/var\/lib\/messages.

.. option:: -l, --lockfile arg

   Path to lock file.

.. option:: --console arg

   Send log output to stdout.

.. option:: --debug

   Execute in debug mode.
   Equivalent to \-\-verbosity\=4 \-\-console\=1 .

.. option:: --trace

   Execute in trace mode.
   Equivalent to \-\-verbosity\=4 \-\-console\=1 \-\-print\-component\=1
   \-\-print\-context\=1 .

.. option:: --log-file arg

   Use alternative log file.


Server
------

.. option:: --port int

   Overrides configuration parameter :confval:`port`.


.. option:: --sslport int

   Overrides configuration parameter :confval:`sslport`.


.. option:: --certificate string

   Overrides configuration parameter :confval:`certificate`.


.. option:: --privateKey string

   Overrides configuration parameter :confval:`privateKey`.


.. option:: --filebase string

   Overrides configuration parameter :confval:`filebase`.


.. option:: --segments int

   Overrides configuration parameter :confval:`segments`.


.. option:: --segsize int

   Overrides configuration parameter :confval:`segsize`.


.. option:: --recsize int

   Overrides configuration parameter :confval:`recsize`.


.. option:: --granularity int

   Overrides configuration parameter :confval:`granularity`.


