From c46d328e2f1eed1f1f1b133f65662b1eebd8f25f Mon Sep 17 00:00:00 2001 From: Andres Smith Date: Fri, 15 Mar 2024 15:00:03 +0100 Subject: [PATCH] Improve README for first release --- Makefile | 6 +++++- README.md | 63 +++++++++++++++++++++++++++++++++++++++++++++++-------- 2 files changed, 59 insertions(+), 10 deletions(-) diff --git a/Makefile b/Makefile index c381af3..b7e8374 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ PLUGIN_NAME=nanoandrew4/ngcplogs -PLUGIN_TAG=latest +PLUGIN_TAG=v1.0.0 PLUGIN_DIR=./ngcplogs-plugin all: clean docker rootfs create local: clean docker rootfs create enable @@ -37,5 +37,9 @@ enable: docker plugin enable ${PLUGIN_NAME}:${PLUGIN_TAG} push: clean docker rootfs create enable + @echo "### push plugin ${PLUGIN_NAME}:latest" + docker plugin push ${PLUGIN_NAME}:latest + +push-release: clean docker rootfs create enable @echo "### push plugin ${PLUGIN_NAME}:${PLUGIN_TAG}" docker plugin push ${PLUGIN_NAME}:${PLUGIN_TAG} \ No newline at end of file diff --git a/README.md b/README.md index 9adcab3..253e57b 100644 --- a/README.md +++ b/README.md @@ -1,4 +1,7 @@ # ngcplogs + +[Dockerhub](https://hub.docker.com/repository/docker/nanoandrew4/ngcplogs/general) + A modified version of the standard `gcplogs` docker logging driver. The standard `gcplogs` driver does not process the output from the containers, which means JSON logs result in a log like this: @@ -34,9 +37,40 @@ output from the containers, which means JSON logs result in a log like this: } ``` -This driver behaves similarly to the `gcplogs` one, but if it detects a JSON log, it unmarshals it and sends the unmarshalled map as the payload, resulting in a log like this: +This driver behaves similarly to the `gcplogs` one, but if it detects a JSON log, it unmarshals it and sends the unmarshalled map as the payload, resulting in a log like this (with the default options): ```json - +{ + "insertId": "yero77f8j919i9", + "jsonPayload": { + "msg": "Updating at 2024-03-15 11:21:38.56773049 +0000 UTC m=+901.837891394\n", + "app": "sample-app", + "container": { + "created": "2024-03-15T11:06:28.730214829Z", + "id": "af2c42f7720c8dec812abc5d7cee903aaadf1cd04d87488f3ab1657b92977bc6", + "name": "/sample-app", + "imageId": "sha256:360b4beb988121df8587572c42af15102a14ecc7c3a5d4cdf221d5d67b29acdc", + "imageName": "nanoandrew4/sample-app" + }, + "instance": { + "zone": "us-east1-b", + "name": "gcp-vm", + "id": "8319386972505717539" + }, + "time": "2024-03-15T11:21:40Z" + }, + "resource": { + "type": "gce_instance", + "labels": { + "zone": "us-east1-b", + "instance_id": "8390836155502727539", + "project_id": "someproject" + } + }, + "timestamp": "2024-03-15T11:21:40.080322442Z", + "severity": "INFO", + "logName": "projects/someproject/logs/ngcplogs-docker-driver", + "receiveTimestamp": "2024-03-15T11:21:44.099223634Z" +} ``` Non JSON logs will not be processed, and will be sent to GCP as they were received, without being manipulated. @@ -44,11 +78,10 @@ Non JSON logs will not be processed, and will be sent to GCP as they were receiv ### Installation ```shell -docker plugin install nanoandrew4/ngcplogs -docker plugin enable nanoandrew4/ngcplogs +docker plugin install nanoandrew4/ngcplogs:v1.0.0 --grant-all-permissions ``` -In your `daemon.json` file, change the `log-driver` to `nanoandrew4/ngcplogs` +In your `daemon.json` file, change the `log-driver` to `nanoandrew4/ngcplogs:v1.0.0` Finally, restart the daemon and docker services: @@ -57,14 +90,26 @@ sudo systemctl daemon-reload && sudo systemctl restart docker ``` ### Upgrading -First stop all containers using the plugin. Once they are all stopped, run the following commands +First stop all containers using the plugin. Once they are all stopped, run the following commands, supposing there was a +version v0.1.0, and we want to upgrade to use v1.0.0 + +```shell +docker plugin disable nanoandrew4/ngcplogs:v0.1.0 +docker plugin rm nanoandrew4/ngcplogs:v0.1.0 +docker plugin install nanoandrew4/ngcplogs:v1.0.0 --grant-all-permissions +``` + + +In your `daemon.json` file, change the `log-driver` to `nanoandrew4/ngcplogs:v1.0.0` + +Finally, restart the daemon and docker services: ```shell -docker plugin disable nanoandrew4/ngcplogs -docker plugin upgrade nanoandrew4/ngcplogs -docker plugin enable nanoandrew4/ngcplogs +sudo systemctl daemon-reload && sudo systemctl restart docker ``` +Start all your containers again, and they should be using the new version of the plugin + ### Configuration The following [log-opts](https://docs.docker.com/config/containers/logging/configure/#configure-the-default-logging-driver) are available for configuration: