1
0
Форкнуть 0

Redirect Caddy logs to file to avoid large log volume

This commit is contained in:
Pericles Alves 2021-03-10 20:51:48 -08:00
Родитель 645c7d8615
Коммит f4ce72011b
5 изменённых файлов: 18 добавлений и 21 удалений

Двоичные данные
Docs/Assets/caddy-logs.png Normal file

Двоичный файл не отображается.

После

Ширина:  |  Высота:  |  Размер: 187 KiB

Просмотреть файл

@ -362,6 +362,12 @@ The Caddy webserver deployed in the solution uses [Let's Encrypt](https://letsen
This service is free. If desired, you may use a different
[certificate authority and webserver configuration](https://docs.microsoft.com/en-us/azure/container-instances/container-instances-container-group-ssl).
To reduce the amount of logs stored in the Log Analytics workspace, the Caddy webserver output is redirected to a file.
To inspect the webserver logs, navigate to the Bridge container group in Azure Portal (whose name starts with `iotc-container-groups-`), under `Containers` select the `caddy-ssl-server` container. Click the `Connect` tab and select `/bin/sh`. The logs
will be in the `/tmp/caddy.log` file. To see the last 10 lines of logs, use the command `tail -n 10 /tmp/caddy.log`, as in the image below:
![Webserver logs](Docs/Assets/caddy-logs.png "webserver logs")
## Custom adapters
One of the possible ways to extend the functionality of this Bridge is through a custom adapter deployed as a sidecar container.
With this type of adapter, which can be written in the language and runtime of your choice, you can for instance transform

Просмотреть файл

@ -168,14 +168,11 @@ echo " - name: \"${bridgeContainerName}\"
cpu: 0.8
- name: caddy-ssl-server
properties:
image: caddy:latest
image: caddy@sha256:d0b43ebda8fd47409cec98d5f3c3b4c60bfc6bca35338313c002dc64c2283055
command:
- \"caddy\"
- \"run\"
- \"--config\"
- \"/mnt/caddyfile\"
- \"--adapter\"
- \"caddyfile\"
- \"/bin/sh\"
- \"-c\"
- \"caddy run --config /mnt/caddyfile --adapter caddyfile 2>> /tmp/caddy.log\"
ports:
- protocol: TCP
port: 443

Просмотреть файл

@ -321,14 +321,11 @@
{
"name": "caddy-ssl-server",
"properties": {
"image": "caddy:latest",
"image": "caddy@sha256:d0b43ebda8fd47409cec98d5f3c3b4c60bfc6bca35338313c002dc64c2283055",
"command": [
"caddy",
"reverse-proxy",
"--from",
"[concat(parameters('bridge-name'), '.', resourceGroup().location, '.azurecontainer.io')]",
"--to",
"localhost:3000"
"/bin/sh",
"-c",
"[concat('caddy reverse-proxy --from ', parameters('bridge-name'), '.', resourceGroup().location, '.azurecontainer.io', ' --to localhost:3000 2>> /tmp/caddy.log')]"
],
"ports": [
{

Просмотреть файл

@ -273,14 +273,11 @@
{
"name": "caddy-ssl-server",
"properties": {
"image": "caddy:latest",
"image": "caddy@sha256:d0b43ebda8fd47409cec98d5f3c3b4c60bfc6bca35338313c002dc64c2283055",
"command": [
"caddy",
"reverse-proxy",
"--from",
"[concat(parameters('bridge-name'), '.', resourceGroup().location, '.azurecontainer.io')]",
"--to",
"localhost:5001"
"/bin/sh",
"-c",
"[concat('caddy reverse-proxy --from ', parameters('bridge-name'), '.', resourceGroup().location, '.azurecontainer.io', ' --to localhost:5001 2>> /tmp/caddy.log')]"
],
"ports": [
{