Skip to content

Feature request: container log rotate and size limit #3351

Closed

Description

@wenlxie

Feature request

We migrated our cluster from docker to containerd. We are running k8s + containerd + overlayfs now. We used to set the container log size limitation by following configuration of docker:

{
  "log-driver": "json-file",
  "log-opts": {
    "max-size": "10m",
    "max-file": "3" 
  }
}

ref: docker logging driver

Now running in this mode, kubelet is used to rotate the log.
We met issues

  1. Kubelet works abnormal sometimes, and log rotate not work, but container is still running
  2. Container writes lots of logs and kubelet just rotate the log every 10s. We can saw many logs not rotated in some cases and disk full.

Is it better to make containerd support log rotate and size limit than put this feature in kubelet?

@Random-Liu @fuweid

Activity

  1. added
    area/cri
    on Jun 17, 2019
  2. crosbymichael commented on Jun 17, 2019

    @crosbymichael
    Member

    containerd does not do anything with logs. It provides the direct IO to clients (CRI, docker, etc) and they can rotate. We shouldn't have any rotation or the notion of log drivers in the containerd core.

  3. Random-Liu commented on Jun 21, 2019

    @Random-Liu
    Member

    @wenlxie Kubelet should handle container log rotate. If it doesn't meet the requirement or has any issue, we should fix it.

  4. Random-Liu commented on Jun 21, 2019

    @Random-Liu
    Member

    Kubelet works abnormal sometimes, and log rotate not work, but container is still running

    Can you provide more context? We should fix it.

    Container writes lots of logs and kubelet just rotate the log every 10s. We can saw many logs not rotated in some cases and disk full.

    We can make the rotate frequency configurable. However, I think 10s is already very frequent. I think most log rotate solution has this limitation, e.g. logrotate is also periodically invoked with cron. Doesn't Docker log rotate have similar problem? If not, how does Docker solve the problem?

  5. wenlxie commented on Jul 18, 2019

    @wenlxie
    Author

    @crosbymichael We used to use docker to do log rotate and overlayfs quota limitation. But we move from docker to containerd, then these two features missed. These two feature is very important feature for user who want to use containerd. If there is no plan to add such feature to containerd. We should have a way to implemented these two features.

  6. Random-Liu commented on Jul 23, 2019

    @Random-Liu
    Member

    @wenlxie For log rotate, we should improve kubelet log rotate to meet your requirement. I heard some issues about kubelet log rotate in KubeCon CN. Can you list those issues? Let's try to solve them.

    For overlayfs quota limitation, I think we can try to add the support into containerd or the cri plugin first.

  7. wenlxie commented on Aug 2, 2019

    @wenlxie
    Author

    @Random-Liu Sorry for miss the message.

    We can make the rotate frequency configurable. However, I think 10s is already very frequent. I think most log rotate solution has this limitation, e.g. logrotate is also periodically invoked with cron. Doesn't Docker log rotate have similar problem? If not, how does Docker solve the problem?
    Docker checks the logs number and size before writes log to files.

    Issues we met for log rotate:

    1. Log rotate only check running versions of logs, but not care about previous logs.
      If a container keeps running and crash, then there will be lots of logs not cleaned.

    This is the logs from one of the nodes we didn't fixed this issue.

    -bash-4.2# ls
    0.log.20190401-214453.gz    334.log.20190513-214758     347.log.20190514-225714.gz  358.log.20190515-191031     369.log.20190516-162914.gz  380.log.20190517-101928     47.log.20190410-223420
    0.log.20190401-215026.gz    335.log.20190514-002826.gz  347.log.20190514-230057.gz  359.log.20190515-205656.gz  369.log.20190516-163306.gz  382.log.20190517-114856.gz  4.log.20190403-083757.gz
    0.log.20190401-215407.gz    335.log.20190514-003529.gz  347.log.20190514-230518     359.log.20190515-210108.gz  369.log.20190516-163728     382.log.20190517-115147.gz  4.log.20190403-084239.gz
    0.log.20190401-215759       335.log.20190514-004203.gz  348.log.20190515-002624.gz  359.log.20190515-210530.gz  370.log.20190516-184312.gz  382.log.20190517-115539.gz  4.log.20190403-085052.gz
    101.log.20190419-012448     335.log.20190514-005347     348.log.20190515-003056.gz  359.log.20190515-210921     370.log.20190516-184724.gz  382.log.20190517-115941     4.log.20190403-090248
    104.log.20190419-125451     336.log.20190514-033544.gz  348.log.20190515-003608.gz  360.log.20190515-231445.gz  370.log.20190516-185106.gz  383.log.20190517-123354     50.log.20190411-084333
    10.log.20190406-023751.gz   336.log.20190514-033946.gz  348.log.20190515-004352     360.log.20190515-231918.gz  370.log.20190516-185859     384.log.20190517-131642.gz  51.log.20190411-123521
    10.log.20190406-024314.gz   336.log.20190514-034358.gz  349.log.20190515-021913.gz  360.log.20190515-232320.gz  371.log.20190516-194116.gz  384.log.20190517-132155.gz  52.log.20190411-164856
    10.log.20190406-024927.gz   336.log.20190514-034930     349.log.20190515-022255.gz  360.log.20190515-233224     371.log.20190516-194659.gz  384.log.20190517-132556.gz  55.log.20190412-034925
    10.log.20190406-030413      337.log.20190514-053557.gz  349.log.20190515-022557.gz  361.log.20190516-001431.gz  371.log.20190516-195030.gz  384.log.20190517-133209     57.log.20190412-110714
    14270.log                   337.log.20190514-053938.gz  349.log.20190515-022958     361.log.20190516-002113.gz  371.log.20190516-195633     385.log.20190517-142632.gz  58.log.20190412-143821
    154.log.20190426-021351.gz  337.log.20190514-054400.gz  350.log.20190515-043241.gz  361.log.20190516-002435.gz  372.log.20190516-205024.gz  385.log.20190517-143134.gz  5.log.20190403-200251.gz
    154.log.20190426-021733.gz  337.log.20190514-054742     350.log.20190515-043612.gz  361.log.20190516-003258     372.log.20190516-205616.gz  385.log.20190517-143556.gz  5.log.20190403-200723.gz
    154.log.20190426-022215.gz  338.log.20190514-064758.gz  350.log.20190515-044044.gz  362.log.20190516-043313.gz  372.log.20190516-210039.gz  385.log.20190517-144309     5.log.20190403-201557.gz
    154.log.20190426-022707     338.log.20190514-065210.gz  350.log.20190515-044506     362.log.20190516-043614.gz  372.log.20190516-210511     386.log.20190517-161941.gz  5.log.20190403-202340
    1.log.20190402-164223.gz    338.log.20190514-065622.gz  351.log.20190515-054722.gz  362.log.20190516-044016.gz  373.log.20190516-215812.gz  386.log.20190517-162353.gz  64.log.20190413-113431
    1.log.20190402-164836.gz    338.log.20190514-070134     351.log.20190515-055235.gz  362.log.20190516-044428     373.log.20190516-220204.gz  386.log.20190517-162714.gz  67.log.20190413-221104
    1.log.20190402-165549.gz    339.log.20190514-085725.gz  351.log.20190515-055646.gz  363.log.20190516-063936.gz  373.log.20190516-220826.gz  386.log.20190517-163106     68.log.20190414-015548
    1.log.20190402-170001       339.log.20190514-090057.gz  351.log.20190515-060058     363.log.20190516-064327.gz  373.log.20190516-221630     387.log.20190517-182445.gz  6.log.20190404-100918.gz
    329.log.20190513-014736.gz  339.log.20190514-090459.gz  352.log.20190515-085958.gz  363.log.20190516-064739.gz  374.log.20190516-235431.gz  387.log.20190517-182837.gz  6.log.20190404-101259.gz
    329.log.20190513-015620.gz  339.log.20190514-090921     352.log.20190515-090420.gz  363.log.20190516-065101     374.log.20190516-235843.gz  387.log.20190517-183259.gz  6.log.20190404-102143.gz
    329.log.20190513-020543.gz  341.log.20190514-111416.gz  352.log.20190515-090842.gz  364.log.20190516-090327.gz  374.log.20190517-000224.gz  387.log.20190517-183721     6.log.20190404-102836
    329.log.20190513-021607     341.log.20190514-111919.gz  352.log.20190515-091404     364.log.20190516-090719.gz  374.log.20190517-000616     388.log.20190517-195012.gz  70.log.20190414-090122
    330.log.20190513-054535.gz  341.log.20190514-112331.gz  353.log.20190515-111115.gz  364.log.20190516-091110.gz  376.log.20190517-021351.gz  388.log.20190517-195323.gz  72.log.20190414-160818
    330.log.20190513-055529.gz  341.log.20190514-113134     353.log.20190515-111457.gz  364.log.20190516-091904     376.log.20190517-021713.gz  388.log.20190517-195735.gz  75.log.20190415-023721
    330.log.20190513-060433.gz  342.log.20190514-132011.gz  353.log.20190515-111929.gz  365.log.20190516-100532.gz  376.log.20190517-022135.gz  388.log.20190517-200137     76.log.20190415-055936
    330.log.20190513-061337     342.log.20190514-132332.gz  353.log.20190515-112321     365.log.20190516-100945.gz  376.log.20190517-022536     3.log.20190402-235917.gz    78.log.20190415-132533
    331.log.20190513-105023.gz  342.log.20190514-133126.gz  354.log.20190515-122537.gz  365.log.20190516-101417.gz  377.log.20190517-042829.gz  3.log.20190403-000639.gz    82.log.20190416-032958
    331.log.20190513-105716.gz  342.log.20190514-133859     354.log.20190515-122949.gz  365.log.20190516-102230     377.log.20190517-043251.gz  3.log.20190403-001051.gz    88.log.20190417-005739
    331.log.20190513-110610.gz  344.log.20190514-151229.gz  354.log.20190515-123452.gz  366.log.20190516-120413.gz  377.log.20190517-043733.gz  3.log.20190403-002648       89.log.20190417-044444
    331.log.20190513-111413     344.log.20190514-151621.gz  354.log.20190515-124315     366.log.20190516-120835.gz  377.log.20190517-044235     41.log.20190410-012032      8.log.20190405-042055.gz
    332.log.20190513-144212.gz  344.log.20190514-152033.gz  355.log.20190515-143453.gz  366.log.20190516-121257.gz  378.log.20190517-053606.gz  432.log.20190523-015333     8.log.20190405-042828.gz
    332.log.20190513-144714.gz  344.log.20190514-152344     355.log.20190515-143935.gz  366.log.20190516-121859     378.log.20190517-054029.gz  43.log.20190410-080600      8.log.20190405-043219.gz
    332.log.20190513-145618.gz  345.log.20190514-163706.gz  355.log.20190515-144356.gz  367.log.20190516-132838.gz  378.log.20190517-054430.gz  440.log.20190524-002737.gz  8.log.20190405-043913
    332.log.20190513-150532     345.log.20190514-164238.gz  355.log.20190515-145100     367.log.20190516-133240.gz  378.log.20190517-054912     440.log.20190524-003701     91.log.20190417-120608
    333.log.20190513-175552.gz  345.log.20190514-164640.gz  356.log.20190515-164046.gz  367.log.20190516-133701.gz  379.log.20190517-074953.gz  441.log.20190524-040613     94.log.20190417-224800
    333.log.20190513-180505.gz  345.log.20190514-165253     356.log.20190515-164518.gz  367.log.20190516-134515     379.log.20190517-075505.gz  446.log.20190524-194030     95.log.20190418-030809
    333.log.20190513-181420.gz  346.log.20190514-183939.gz  356.log.20190515-164810.gz  368.log.20190516-143305.gz  379.log.20190517-075927.gz  44.log.20190410-115826      9.log.20190405-172022.gz
    333.log.20190513-182424     346.log.20190514-184411.gz  356.log.20190515-165644     368.log.20190516-143857.gz  379.log.20190517-081032     451.log.20190525-114426     9.log.20190405-172746.gz
    334.log.20190513-211927.gz  346.log.20190514-184743.gz  358.log.20190515-185253.gz  368.log.20190516-144329.gz  380.log.20190517-100331.gz  452.log.20190525-150733     9.log.20190405-173148.gz
    334.log.20190513-212810.gz  346.log.20190514-185205     358.log.20190515-185806.gz  368.log.20190516-144851     380.log.20190517-100743.gz  454.log.20190525-213350     9.log.20190405-173831
    334.log.20190513-213724.gz  347.log.20190514-225313.gz  358.log.20190515-190248.gz  369.log.20190516-162542.gz  380.log.20190517-101235.gz  456.log.20190526-035910
    
    1. We met issues when the logs not rotated and have a large file there, not found the root cause yet. We set the log max size to be 10M, and you can see there are logs more than 200M.
    -bash-4.2# ls -lah
    total 15G
    drwxr-xr-x 2 root root 8.0K May 28 18:14 .
    drwxr-xr-x 7 root root 77 May 23 12:10 ..
    -rw-r--r-- 1 root root 4.4M May 28 12:06 10.log.20190528-120628.gz
    -rw-r----- 1 root root 273M May 28 12:06 10.log.20190528-120639
    -rw-r--r-- 1 root root 12M May 28 12:12 11.log.20190528-121201.gz
    -rw-r--r-- 1 root root 7.2M May 28 12:17 12.log.20190528-121735.gz
    -rw-r----- 1 root root 267M May 28 12:17 12.log.20190528-121747
    -rw-r--r-- 1 root root 1.6M May 28 12:23 13.log.20190528-122300.gz
    -rw-r--r-- 1 root root 11M May 28 12:23 13.log.20190528-122310.gz
    -rw-r--r-- 1 root root 2.2M May 28 12:28 14.log.20190528-122834.gz
    -rw-r----- 1 root root 296M May 28 12:28 14.log.20190528-122845
    -rw-r--r-- 1 root root 1.4M May 28 12:34 15.log.20190528-123407.gz
    -rw-r--r-- 1 root root 12M May 28 12:34 15.log.20190528-123417.gz
    -rw-r--r-- 1 root root 1.1M May 28 12:39 16.log.20190528-123942.gz
    -rw-r--r-- 1 root root 11M May 28 12:40 16.log.20190528-123952.gz
    -rw-r--r-- 1 root root 1.5M May 28 12:45 17.log.20190528-124507.gz
    -rw-r--r-- 1 root root 12M May 28 12:45 17.log.20190528-124517.gz
    -rw-r--r-- 1 root root 11M May 28 12:51 18.log.20190528-125051.gz
    -rw-r----- 1 root root 224M May 28 12:51 18.log.20190528-125103
    -rw-r--r-- 1 root root 6.4M May 28 12:56 19.log.20190528-125615.gz
    -rw-r----- 1 root root 251M May 28 12:56 19.log.20190528-125626
    -rw-r--r-- 1 root root 5.0M May 28 13:01 20.log.20190528-130148.gz
    -rw-r----- 1 root root 276M May 28 13:01 20.log.20190528-130159
    -rw-r--r-- 1 root root 2.4M May 28 13:07 21.log.20190528-130712.gz
    -rw-r--r-- 1 root root 11M May 28 13:07 21.log.20190528-130722.gz
    -rw-r--r-- 1 root root 9.2M May 28 13:13 22.log.20190528-131256.gz
    -rw-r----- 1 root root 248M May 28 13:13 22.log.20190528-131308
    -rw-r--r-- 1 root root 4.7M May 28 13:18 23.log.20190528-131821.gz
    -rw-r----- 1 root root 271M May 28 13:18 23.log.20190528-131832
    -rw-r--r-- 1 root root 4.2M May 28 13:24 24.log.20190528-132355.gz
    -rw-r----- 1 root root 279M May 28 13:24 24.log.20190528-132406
    -rw-r--r-- 1 root root 718K May 28 13:29 25.log.20190528-132918.gz
    -rw-r--r-- 1 root root 12M May 28 13:29 25.log.20190528-132928.gz
    -rw-r--r-- 1 root root 8.3M May 28 13:35 26.log.20190528-133453.gz
    -rw-r----- 1 root root 262M May 28 13:35 26.log.20190528-133505
    -rw-r--r-- 1 root root 9.6M May 28 13:40 27.log.20190528-134017.gz
    -rw-r----- 1 root root 245M May 28 13:40 27.log.20190528-134029
    -rw-r--r-- 1 root root 9.4M May 28 13:46 28.log.20190528-134551.gz
    -rw-r----- 1 root root 247M May 28 13:46 28.log.20190528-134603
    -rw-r--r-- 1 root root 9.7M May 28 13:51 29.log.20190528-135114.gz
    -rw-r----- 1 root root 240M May 28 13:51 29.log.20190528-135127
    -rw-r--r-- 1 root root 589K May 28 11:44 2.log.20190528-113154.gz
    -rw-r--r-- 1 root root 590K May 28 11:47 2.log.20190528-114435.gz
    -rw-r--r-- 1 root root 9.7M May 28 11:47 2.log.20190528-114746.gz
    -rw-r----- 1 root root 244M May 28 11:47 2.log.20190528-114758
    -rw-r--r-- 1 root root 4.1M May 28 13:56 30.log.20190528-135638.gz
    -rw-r----- 1 root root 263M May 28 13:56 30.log.20190528-135649
    -rw-r--r-- 1 root root 905K May 28 14:02 31.log.20190528-140200.gz
    -rw-r--r-- 1 root root 11M May 28 14:02 31.log.20190528-140210.gz
    -rw-r--r-- 1 root root 2.6M May 28 14:07 32.log.20190528-140735.gz
    -rw-r----- 1 root root 269M May 28 14:07 32.log.20190528-140745
    -rw-r--r-- 1 root root 10M May 28 14:13 33.log.20190528-141308.gz
    -rw-r----- 1 root root 238M May 28 14:13 33.log.20190528-141320
    -rw-r--r-- 1 root root 5.5M May 28 14:18 34.log.20190528-141831.gz
    -rw-r----- 1 root root 272M May 28 14:18 34.log.20190528-141842
    -rw-r--r-- 1 root root 6.2M May 28 14:24 35.log.20190528-142406.gz
    -rw-r----- 1 root root 282M May 28 14:24 35.log.20190528-142417
    -rw-r--r-- 1 root root 9.2M May 28 14:29 36.log.20190528-142941.gz
    -rw-r----- 1 root root 250M May 28 14:29 36.log.20190528-142952
    -rw-r--r-- 1 root root 3.5M May 28 14:34 37.log.20190528-143445.gz
    -rw-r--r-- 1 root root 12M May 28 14:35 37.log.20190528-143456.gz
    -rw-r--r-- 1 root root 9.5M May 28 14:35 38.log.20190528-143531.gz
    -rw-r--r-- 1 root root 11M May 28 14:36 39.log.20190528-143625.gz
    -rw-r--r-- 1 root root 6.8M May 28 11:48 3.log.20190528-114808.gz
    -rw-r----- 1 root root 247M May 28 11:48 3.log.20190528-114820
    -rw-r--r-- 1 root root 5.0M May 28 14:37 40.log.20190528-143730.gz
    -rw-r----- 1 root root 307M May 28 14:37 40.log.20190528-143743
    -rw-r--r-- 1 root root 2.3M May 28 14:39 41.log.20190528-143913.gz
    -rw-r----- 1 root root 301M May 28 14:39 41.log.20190528-143924
    -rw-r--r-- 1 root root 535K May 28 14:42 42.log.20190528-144215.gz
    -rw-r--r-- 1 root root 12M May 28 14:42 42.log.20190528-144225.gz
    -rw-r--r-- 1 root root 550K May 28 14:48 43.log.20190528-144749.gz
    -rw-r--r-- 1 root root 11M May 28 14:48 43.log.20190528-144800.gz
    -rw-r----- 1 root root 202M May 28 14:48 43.log.20190528-144812
    -rw-r--r-- 1 root root 2.1M May 28 14:53 44.log.20190528-145325.gz
    -rw-r----- 1 root root 328M May 28 14:53 44.log.20190528-145337
    -rw-r--r-- 1 root root 1.3M May 28 14:58 45.log.20190528-145848.gz
    -rw-r----- 1 root root 286M May 28 14:58 45.log.20190528-145858
    -rw-r--r-- 1 root root 6.9M May 28 15:04 46.log.20190528-150420.gz
    -rw-r----- 1 root root 278M May 28 15:04 46.log.20190528-150431
    -rw-r--r-- 1 root root 9.9M May 28 15:10 47.log.20190528-150953.gz
    -rw-r----- 1 root root 228M May 28 15:10 47.log.20190528-151005
    -rw-r--r-- 1 root root 8.3M May 28 15:15 48.log.20190528-151517.gz
    -rw-r----- 1 root root 263M May 28 15:15 48.log.20190528-151529
    -rw-r--r-- 1 root root 7.4M May 28 15:21 49.log.20190528-152050.gz
    -rw-r----- 1 root root 267M May 28 15:21 49.log.20190528-152102
    -rw-r--r-- 1 root root 4.4M May 28 11:48 4.log.20190528-114842.gz
    -rw-r----- 1 root root 320M May 28 11:48 4.log.20190528-114855
    -rw-r--r-- 1 root root 6.7M May 28 15:26 50.log.20190528-152614.gz
    -rw-r----- 1 root root 262M May 28 15:26 50.log.20190528-152626
    -rw-r--r-- 1 root root 3.5M May 28 15:31 51.log.20190528-153148.gz
    -rw-r----- 1 root root 281M May 28 15:31 51.log.20190528-153159
    -rw-r--r-- 1 root root 8.9M May 28 15:37 52.log.20190528-153731.gz
    -rw-r--r-- 1 root root 9.5M May 28 15:43 53.log.20190528-154257.gz
    -rw-r----- 1 root root 245M May 28 15:43 53.log.20190528-154309
    -rw-r--r-- 1 root root 4.2M May 28 15:48 54.log.20190528-154821.gz
    -rw-r----- 1 root root 284M May 28 15:48 54.log.20190528-154832
    -rw-r----- 1 root root 215M May 28 15:54 55.log.20190528-155402
    -rw-r--r-- 1 root root 8.8M May 28 15:59 56.log.20190528-155925.gz
    -rw-r----- 1 root root 243M May 28 15:59 56.log.20190528-155937
    -rw-r--r-- 1 root root 11M May 28 16:05 57.log.20190528-160459.gz
    -rw-r----- 1 root root 232M May 28 16:05 57.log.20190528-160511
    -rw-r--r-- 1 root root 1.4M May 28 16:10 58.log.20190528-161022.gz
    -rw-r----- 1 root root 296M May 28 16:10 58.log.20190528-161033
    -rw-r--r-- 1 root root 4.0M May 28 16:16 59.log.20190528-161555.gz
    -rw-r----- 1 root root 266M May 28 16:16 59.log.20190528-161606
    -rw-r--r-- 1 root root 6.1M May 28 11:49 5.log.20190528-114936.gz
    -rw-r----- 1 root root 306M May 28 11:49 5.log.20190528-114949
    -rw-r--r-- 1 root root 8.0M May 28 16:21 60.log.20190528-162128.gz
    -rw-r----- 1 root root 265M May 28 16:21 60.log.20190528-162142
    -rw-r--r-- 1 root root 1.4M May 28 16:27 61.log.20190528-162652.gz
    -rw-r--r-- 1 root root 12M May 28 16:27 61.log.20190528-162703.gz
    -rw-r--r-- 1 root root 7.8M May 28 16:32 62.log.20190528-163228.gz
    -rw-r----- 1 root root 263M May 28 16:32 62.log.20190528-163240
    -rw-r--r-- 1 root root 5.3M May 28 16:38 63.log.20190528-163751.gz
    -rw-r----- 1 root root 281M May 28 16:38 63.log.20190528-163802
    -rw-r--r-- 1 root root 1.7M May 28 16:43 64.log.20190528-164324.gz
    -rw-r--r-- 1 root root 12M May 28 16:43 64.log.20190528-164334.gz
    -rw-r--r-- 1 root root 1.6M May 28 16:48 65.log.20190528-164849.gz
    -rw-r----- 1 root root 280M May 28 16:48 65.log.20190528-164859
    -rw-r--r-- 1 root root 11M May 28 16:54 66.log.20190528-165430.gz
    -rw-r--r-- 1 root root 4.7M May 28 17:00 67.log.20190528-165954.gz
    -rw-r----- 1 root root 277M May 28 17:00 67.log.20190528-170005
    -rw-r--r-- 1 root root 957K May 28 17:05 68.log.20190528-170516.gz
    -rw-r--r-- 1 root root 12M May 28 17:05 68.log.20190528-170526.gz
    -rw-r--r-- 1 root root 893K May 28 17:11 69.log.20190528-171051.gz
    -rw-r--r-- 1 root root 11M May 28 17:11 69.log.20190528-171101.gz
    -rw-r--r-- 1 root root 7.2M May 28 11:50 6.log.20190528-115041.gz
    -rw-r----- 1 root root 265M May 28 11:50 6.log.20190528-115053
    -rw-r--r-- 1 root root 1.6M May 28 17:16 70.log.20190528-171625.gz
    -rw-r--r-- 1 root root 12M May 28 17:16 70.log.20190528-171636.gz
    -rw-r--r-- 1 root root 622K May 28 17:22 71.log.20190528-172151.gz
    -rw-r--r-- 1 root root 11M May 28 17:22 71.log.20190528-172201.gz
    -rw-r--r-- 1 root root 11M May 28 17:27 72.log.20190528-172734.gz
    -rw-r--r-- 1 root root 3.0M May 28 17:33 73.log.20190528-173257.gz
    -rw-r--r-- 1 root root 12M May 28 17:33 73.log.20190528-173308.gz
    -rw-r--r-- 1 root root 4.5M May 28 17:38 74.log.20190528-173834.gz
    -rw-r----- 1 root root 275M May 28 17:38 74.log.20190528-173845
    -rw-r--r-- 1 root root 9.4M May 28 17:44 75.log.20190528-174408.gz
    -rw-r----- 1 root root 245M May 28 17:44 75.log.20190528-174420
    -rw-r--r-- 1 root root 3.7M May 28 17:49 76.log.20190528-174933.gz
    -rw-r----- 1 root root 255M May 28 17:49 76.log.20190528-174946
    -rw-r--r-- 1 root root 8.3M May 28 11:52 7.log.20190528-115225.gz
    -rw-r----- 1 root root 236M May 28 11:52 7.log.20190528-115237
    -rw-r----- 1 root root 15M May 28 18:14 84.log
    -rw-r--r-- 1 root root 7.6M May 28 11:55 8.log.20190528-115529.gz
    -rw-r----- 1 root root 260M May 28 11:55 8.log.20190528-115541
    -rw-r--r-- 1 root root 7.6M May 28 12:01 9.log.20190528-120103.gz
    -rw-r----- 1 root root 257M May 28 12:01 9.log.20190528-120115
    
  8. vsxen commented on Sep 6, 2019

    @vsxen

    /watch

  9. strainovic commented on Oct 1, 2019

    @strainovic

    Any update on this issue?

    Thanks!

  10. reopened this on Oct 8, 2019
  11. wenlxie commented on Oct 8, 2019

    @wenlxie
    Author
  12. vishiy commented on Jan 8, 2020

    @vishiy

    /watch

  13. crosbymichael commented on Jan 8, 2020

    @crosbymichael
    Member

    I'm going to close this. There is zero code in containerd that handles logs at all. @Random-Liu said this is more of a kubelet issue so it would be better served to have an issue like this on the kube side.

  14. strigazi commented on May 29, 2020

    @strigazi

    For future searches,
    kubelet has --container-log-max-files and --container-log-max-size implemented by Random-Liu (kubernetes/kubernetes#59898) , so logrotation should work pretty well. At least for me, the defaults were fine per my testing (5 files, max 10Mi each).

    I haven't found something for json-file in kubelet so far. I'm having a look.

    --container-log-max-files int32
      | <Warning: Beta feature> Set the maximum number of container log files that can be present for a container. The number must be ≥ 2. This flag can only be used with --container-runtime=remote. (default 5) (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)
    --container-log-max-size string
      | <Warning: Beta feature> Set the maximum size (e.g. 10Mi) of container log file before it is rotated. This flag can only be used with --container-runtime=remote. (default "10Mi") (DEPRECATED: This parameter should be set via the config file specified by the Kubelet's --config flag. See https://kubernetes.io/docs/tasks/administer-cluster/kubelet-config-file/ for more information.)
    
  15. ydcool commented on Mar 13, 2021

    @ydcool

    Is it possible to introduce some basic (or fallback) mechanism in containerd to prevent the logs increasing without limit when the kubelet is not working?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    area/crikind/feature

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions