acrn-hypervisor/tools/acrnlog
Tw 33ecdd7389 Makefile: undefine _FORTIFY_SOURCE prior using it
Currently, we are enforcing the _FORTIFY_SOURCE=2 without any
previous detection if the macro has been already defined, e.g.
by environment, or is just enabled by compiler by default on
some distributions (e.g. Gentoo).

This could result in the error like this:
<command-line>:0:0: error: "_FORTIFY_SOURCE" redefined [-Werror]
<built-in>: note: this is the location of the previous definition

Tracked-On: #2344
Signed-off-by: Tw <wei.tan@intel.com>
Reviewed-by: Binbin Wu <binbin.wu@intel.com>
Acked-by: Yin Fengwei <fengwei.yin@intel.com>
2019-02-28 11:56:45 +08:00
..
Makefile Makefile: undefine _FORTIFY_SOURCE prior using it 2019-02-28 11:56:45 +08:00
README.rst doc: fix formatting in acrnlog doc 2018-06-20 11:28:36 +08:00
acrnlog.c tools: acrnlog: give user hint when acrn hvlog devices not found 2018-12-05 13:16:20 +08:00
acrnlog.service misc: Remove unnecessary ExecStop in systemd services 2018-08-09 08:58:12 +08:00

README.rst

.. _acrnlog:

acrnlog
#######

Description
***********

``acrnlog`` is a userland tool used to capture a ACRN hypervisor log. It runs as an
SOS service at boot, capturing two kinds of logs:

- log of the currently running hypervisor
- log of last running hypervisor if it crashed and the logs remain.

Log files are saved in ``/tmp/acrnlog/``, so the log files would be lost
after a system reset.

Usage
*****

The ``acrnlog`` tool is launched as a service at boot, and limited to
supporting four 1MB log files by default.  You can change this log file
limitation temporarily or permanently.

Options:

  -h  display help
  -t  specify a polling interval (ms). Once buffer is empty, acrnlog stops
      and starts reading in specified interval.
      If an incomplete log warning is reported, please try with a smaller
      interval to get a complete log.
  -s  limit the size of each log file, in KB. 0 means no limitation.
  -n  specify the number of log files to keep, old files would be deleted.

Temporary log file changes
==========================

You can temporarily change the log file setting by following these
steps:

1. Stop the ``acrnlog`` service:

   .. code-block:: none

      # systemctl disable acrnlog

2. Restart ``acrnlog``, running in the background, and specify the new
   number of log files and their size (in MB).  For example:

   .. code-block:: none

      # acrnlog -n 8 -s 4 &

You can use ``get_loglevel`` and ``set_loglevel`` commands
in the hypervisor shell (not the Service OS shell)
to query and change the hypervisor log level.

The ``mem_loglevel`` parameter controls the log to be saved using
``acrnlog``, while the ``console_loglevel`` parameter controls the log
output to the console. For example, in the hypervisor shell you
can use these commands:

.. code-block:: none

   ACRN:\>get_loglevel
   console_loglevel: 2, mem_loglevel: 4
   ACRN:\>set_loglevel 2 5
   ACRN:\>get_loglevel
   console_loglevel: 2, mem_loglevel: 5


Permanent log file changes
==========================

You can also permanently change the log file settings by
editing ``/usr/lib/systemd/system/acrnlog.service`` and use the ``-n``
and ``-s`` options on the ``ExecStart`` cmd, and restart the service.
For example, ``acrnlog.service`` could have these parameters added:

.. code-block:: none

   ExecStart=/usr/bin/acrnlog -n 8 -s 4

and then restart the service with:

.. code-block:: none

   # systemctl daemon-reload
   # systemctl restart acrnlog

Build and Install
*****************

Source code for the ``acrnlog`` tools is in the ``tools/acrnlog``
folder.  Build and install the tools from source using:

.. code-block:: none

   # make
   # make install

and if you changed the ``acrnlog.service`` file, install it using:

.. code-block:: none

   # cp acrnlog.service /usr/lib/systemd/system/