Chat Support
Loupe - Log - Monitor - Resolve
Loupe / Developer's Guide / For .NET Core / 6 / 8 / Developer's Guide - Agent Configuration for Containers
In This Topic
    Developer's Guide - Agent Configuration for Containers
    In This Topic

    To capture log data from a Docker Container, any variable configuration needs to be done using environment variables and the container should mount a volume to store log information so it is available over restarts.

    Configuring the Loupe Agent

    Individual Loupe settings will need to be done using the environment variable syntax.  You can minimize the number of settings by configuring items that won't change in code or in an appsettings.json file that ships within the container (which will be loaded first).  Loupe uses the standard .NET configuration order which typically goes code, then configuration files, then environment variables.

    Mounting a Data Volume for Logs

    Whenever a docker container restarts, any changes made to its file system are lost.  This includes log data that Loupe records to the default local paths on unix.

    Configuration in Development

    Docker supports binding a path on the local file system into a container.  The path is visible to both the host application and the container.  Taking advantage of this, you can share a common log folder with the containers you're development and Loupe Desktop so you can view log files for your application without having to first relay them through a Loupe Server. 

    To do this, bind one folder from within your local logs area during the docker startup process, like this:

    docker run -v "C:\ProgramData\Gibraltar\Local Logs\My Product":/var/lib/logs
    

    Additionally, change the default log file path in the container to use /var/lib/logs like this:

    LOUPE__SESSIONFILE__FOLDER=/var/lib/logs
    

    For more information on how Docker Bind works, see Docker Bind Mounts

    Configuration in Deployment

    To persist log files across container restarts, map a volume to the docker container and set Loupe to use this for its log path.  If you have multiple containers, it's recommended to share a single volume with all of the containers to simplify configuration and let them collaborate to relay information to the Loupe Server.

    docker run --mount source=yourvolname,target=/var/lib/logs
    

    Additionally, change the default log file path in the container to use /var/lib/logs like this:

    LOUPE__SESSIONFILE__FOLDER=/var/lib/logs
    

    For more information on how docker volumes work, see Docker Storage Volumes

    See Also