[OCI] Cannot access logs to sqlserver

Hello,

I’m playing around with OCI to check the possibilities.

To do so I’ve done :

incus remote add mcr-microsoft-com https://mcr.microsoft.com --protocol oci
incus create mcr-microsoft-com:mssql/server:2019-latest app-sqlserver-2019-oci -p apps -p docker -c environment.ACCEPT_EULA=Y -c environment.MSSQL_SA_PASSWORD='...'
incus launch app-sqlserver-2019-oci

So far so good container is starting.
Now I wanted to see logs :

# incus info --show-log app-sqlserver-2019-oci
Name: app-sqlserver-2019-oci
Description:
Status: RUNNING
Type: container (application)
Architecture: x86_64
PID: 2003603
Created: 2025/03/19 08:29 CET
Last Used: 2025/03/19 08:31 CET
Started: 2025/03/19 08:31 CET

Resources:
  Processes: 171
  Disk usage:
    root: 13.67MiB
  CPU usage:
    CPU usage (in seconds): 25
  Memory usage:
    Memory (current): 1.11GiB
  Network usage:
    lo:
      Type: loopback
      State: UP
      MTU: 65536
      Bytes received: 1.05MB
      Bytes sent: 1.05MB
      Packets received: 1756
      Packets sent: 1756
      IP addresses:
        inet:  127.0.0.1/8 (local)
        inet6: ::1/128 (local)
    vmbr0:
      Type: broadcast
      State: UP
      Host interface: vethdc4ec7dd
      MAC address: 00:16:3e:86:81:e4
      MTU: 1500
      Bytes received: 39.96kB
      Bytes sent: 1.08kB
      Packets received: 619
      Packets sent: 14
      IP addresses:
        inet6: fe80::216:3eff:fe86:81e4/64 (link)
    vmbr3:
      Type: broadcast
      State: UP
      Host interface: veth07162626
      MAC address: 00:16:3e:aa:f1:a9
      MTU: 1500
      Bytes received: 210B
      Bytes sent: 1.01kB
      Packets received: 3
      Packets sent: 13
      IP addresses:
        inet6: fe80::216:3eff:feaa:f1a9/64 (link)

Log:

lxc app-sqlserver-2019-oci 20250319073209.412 WARN     attach - ../src/lxc/attach.c:lxc_attach:1604 - Could not change directory to "/home/mssql"

Any idea ?

Version:

# incus version
Client version: 6.10.1
Server version: 6.10.1

Hi!

incus info --show-log mycontainer shows at the end the logs that relate to Incus. In fact, it’s the content of the file /var/log/incus/mycontainer/lxc.log.

If you are looking for the logs of the specific application (here, SQL Server), then Incus is not aware of them. Such application logs are not in the purview of Incus. You would need to use either incus exec or incus file to get access to those files. If the logs are available over the network, you would use a suitable client software on the host and configure it to pull them from the application container.

An example with incus file, assuming the logs are in /var/log/sqlserver/server.log (I don’t know the actual filename). In this example, the file is saved to -, which is a special notation to get the contents printed on the screen (not saved to some actual file).

$ incus file pull mycontainer/var/log/sqlserver/server.log -
...
$
1 Like

Hi

Still one question, usually we logs thru docker logs <container> for the ones written in standard console.

How to do this in incus ?
Will it be possible to forward those logs to Loki ?

Thanks

Hello,

incus start mycontainer --console will print console output to stdout during container start. After leaving the console with ctrl a and q you can view the out put under /var/log/incus/mycontainer/console.log think there is also an incise command to get latest log output.

There is an open github ticket to support log file uploads to syslog or loki (Configurable syslog targets · Issue #1420 · lxc/incus · GitHub) alternative you can implement a custom solution and grep them from /var/log/incus/...