diff --git a/plugins/in_docker/cgroup_v1.c b/plugins/in_docker/cgroup_v1.c index ab401478e72..4d2355acb8a 100644 --- a/plugins/in_docker/cgroup_v1.c +++ b/plugins/in_docker/cgroup_v1.c @@ -215,7 +215,7 @@ static char *get_config_file(struct flb_docker *ctx, char *id) static char *extract_name(char *line, char *start) { - int skip = 9; + int skip = sizeof(DOCKER_NAME_ARG)-1; int len = 0; char *name; char buff[256]; diff --git a/plugins/in_docker/cgroup_v2.c b/plugins/in_docker/cgroup_v2.c index 295483cd259..3a19a8105c1 100644 --- a/plugins/in_docker/cgroup_v2.c +++ b/plugins/in_docker/cgroup_v2.c @@ -232,7 +232,7 @@ static char *get_config_file(struct flb_docker *ctx, char *id) static char *extract_name(char *line, char *start) { - int skip = 9; + int skip = sizeof(DOCKER_NAME_ARG)-1; int len = 0; char *name; char buff[256]; diff --git a/plugins/in_docker/docker.h b/plugins/in_docker/docker.h index e6f61c1cdeb..6ff1655058a 100644 --- a/plugins/in_docker/docker.h +++ b/plugins/in_docker/docker.h @@ -59,7 +59,7 @@ #define DOCKER_CGROUP_V2_CPU_USAGE_TEMPLATE DOCKER_CGROUP_V2_CPU_USAGE_KEY" %lu" #define DOCKER_CONFIG_JSON "config.v2.json" -#define DOCKER_NAME_ARG "\"Name\"" +#define DOCKER_NAME_ARG "\"Name\":\"/" #define DEFAULT_INTERVAL_SEC "1" #define DEFAULT_INTERVAL_NSEC "0"