Search code examples
javaamazon-ecs

How to output Java HeapDump to persistent storage with ECS on Fargate 1.3.0


I am using Fargate1.3.0 to run Java17+SpringBoot2.7 applications. Please let me know how to output HeapDump to persistent storage such as s3 when OutOfMemoryError occurs. I think EFS can be used with ECS on Fargate 1.4.0, but for some reason I can't upgrade the version.

I tried outputting with FluentBit running on the sidecar, but I couldn't output the file. Please let me know if there are any errors in the settings. Please let me know if there is any other better way.

fluentbit conf

[INPUT]
    Name tail
    Path /logs/*
    Pefresh_Interfal 5
    Tag  jvmlogs

[OUTPUT]
    Name firehose
    Match jvmlogs
    regsion ap-northeast-1
    delivery_strysteam XXX

Solution

  • You can leverage the -XX:OnOutOfMemoryError JVM param to run a command in this case (e.g. use a aws s3 CLI call to move the heapdump to an S3 bucket).