Logs¶
Where are the adapter logs stored locally?¶
Logs generated by mp-test
or mp-build
are stored in the logs
sub-directory of the
project.
Where are the adapter logs stored in VMware Aria Operations?¶
Logs are generated and stored on the cloud proxy where the adapter is running at $ALIVE_BASE/user/log/adapter/<ADAPTERKEY>/<ADAPTER_INTERNAL_INSTANCE_ID>
.
ADAPTERKEY
should match the adapter key used in the manifest.txt
, and the ADAPTER_INTERNAL_INSTANCE_ID
should match the Internal ID
found in VMware Aria Operations at Environment → Inventory → Adapter Instances → <ADAPTER_DISPLAY_NAME> → <ADAPTER_INSTANCE> in the rightmost column.
The Internal ID
column is not displayed by default. To display the Internal ID, enable the Internal ID
column by clicking the lower left 'column' icon and then checking the Internal ID
box.
What are the different log files used for?¶
There are five types of log files: adapter, server, build, test, and validation logs. Each log file is prepended with the type of log file followed by a number that represents rollover.
-
server.log
: Contains all logs related to the HTTP server inside the container. Server logs can't be modified since the server code comes packaged inside the base-adapter Python image. -
adapter.log
Contains all logs related to the adapter. Adapter logs are all the logs generated by adapter code (e.g., the test() method or the collect() methods insideapp/adapter.py
). -
test.log
Contains all logs related tomp-test
. -
build.log
Contains all logs related tomp-build
. -
validation.log
Contains a log of the validations performed bymp-test
on the collection results. Validation logs are only generated locally.
How do I add logs to my adapter?¶
The template adapter defines a logger variable in the adapter.py
file that configures all adapter logging using adapter_logging from the Python SDK.
The logger only needs to be configured once; to generate logs in other files, simply import the Python logging module. Eg.
import logging
logger = logging.getLogger(__name__)
def my_method():
logger.info("info log")
logger.warning("warning log")
logger.error("error log")
logger.debug("debug log")
...
How do I change the server and/or adapter log level?¶
You can set the log levels for the server and adapter inside the loglevels.cfg
file, which is located in logs/loglevels.cfg
locally and on the cloud proxy at $ALIVE_BASE/user/log/adapters/<ADAPTERKEY>/<ADAPTER_INTERNAL_INSTANCE_ID>/loglevels.cfg
.
If the file does not exist, the system generates it after a collection/test.
ADAPTERKEY
should match the name of the adapter used in the manifest.txt
, and the ADAPTER_INTERNAL_INSTANCE_ID
should match the Internal ID
found in VMware Aria Operations at Environment → Inventory → Adapter Instances → <ADAPTER_DISPLAY_NAME> → <ADAPTER_INSTANCE> in the rightmost column.
The Internal ID
column is not displayed by default. To display the Internal ID, enable the Internal ID
column by clicking the lower left 'column' icon and then checking the Internal ID
box.
How do I change the log level of mp-init, mp-test, or mp-build?¶
All SDK tools read the LOG_LEVEL environment variable to set the log level of their console output. For example, to set log level to debug to see a verbose output of the any of the CLI tools we can set the LOG_LEVEL variable:
For Linux and macOS
For Windows For Windows, set the log level back toinfo
after debugging.
The SDK CLI tools support debug
, warn
, info
, and error
levels.