Configuring Postgres Workload Report
====================================

To reduce the number of command-line arguments needed when executing
``pwr`` , you can use a configuration file to specify options that
always have the same value and whose values differ from the default.

..  Note::
   `edb-lasso`  requires a configuration file to be present to work properly. If it's not configured correctly, `pwr`  will fail to complete. See the  :ref:`Lasso documentation </lasso/latest/configuration/>`  for more information on how to configure it.

Configuration file locations
----------------------------

Postgres Workload Report looks for a configuration file in the following
places and uses the first one found:

1. The file named in the ``--config`` command-line option, if given.

2. The file named in the ``PWR_CONFIG_FILE`` environment variable, if
   set.

3. ``~/.pwr.conf`` .

4. ``/etc/pwr.conf`` .

The installation package creates a template for the configuration file
in ``/etc/pwr.conf.templ`` . We recommend copying this file to one of
the two places where Postgres Workload Report looks for a configuration
file by default (``~/.pwr.conf`` and ``/etc/pwr.conf`` ), and editing
the options in the template as necessary.

..  Note::
   If no configuration file is found, Postgres Workload Report assumes the default value for all options, which you can still override using the corresponding command-line options. See  :ref:`Using Postgres Workload Report <Using Postgres Workload Report>`  for more on using command-line options.

..  Note::
   Although the configuration file extension is `.conf` , its content must be in **valid** YAML format.

Configuration file options
--------------------------

input_dir
^^^^^^^^^

An existing directory where the ``edb_wait_states`` portion of a Lasso
report is located. This option is used mainly for ``pwr report``
execution (see :ref:`Using Postgres Workload Report <Using Postgres Workload Report>`  ).

output_dir
^^^^^^^^^^

Location of the directory where Postgres Workload Report writes report
files. Executing ``pwr`` creates this directory if it doesn’t exist.

report_name
^^^^^^^^^^^

The name of the report files generated. Usually, you specify this option
on the command line because different reports typically have different
names.

Don’t include a file extension. An appropriate extension is added based
on the output formats specified on the command line (that is, ``--pdf``
adds ``.pdf`` , ``--html`` adds ``.html`` , and so on).

log_file
^^^^^^^^

The full path to the file where Postgres Workload Report writes the
``stdout`` and ``stderr`` logs.

log_level
^^^^^^^^^

The logging level to use when running Postgres Workload Report. The
following are valid values, listed from more verbose to less verbose:

-  ``DEBUG``

-  ``INFO`` (default if not specified)

-  ``WARNING``

-  ``ERROR``

-  ``CRITICAL``

See `the Python logging <https://docs.python.org/3/library/logging.html#logging-levels>`_  documentation for more information about log levels.

log_format
^^^^^^^^^^

The format of the log messages that are written to the log file. See
 `the Python logging <https://docs.python.org/3/library/logging.html#logrecord-attributes>`_  documentation for more information on log formatting.

assets_dir
^^^^^^^^^^

The directory containing the Jinja templates used to format the HTML
output and the CSS used for PDF output. The default value is
``/usr/share/pwr/assets`` , which contains the assets provided with the
``edb-pwr`` package.
