Search code examples
scalaamazon-s3gatlingscala-gatling

Gatling: upload simulation.log to S3 bucket from simulation


I would like to upload the simulation.log file of a scenario to an S3 bucket once my simulation is finished.

I was thinking of adding the upload in the after block of my simulation.

I didn't find any example that does that. I only found scripts external to the simulation taking care if it.

Is there any reason why I shouldn't do it?

If not, how can I get the absolute path of the simulation.log?


Solution

  • Unfortunately block 'after' execute early then generating report. I would advise writing a script that runs after the test.

    1. Go to directory with the last report.
    cd target/gatling && cd "$(ls -td -- */ | head -n 1 | cut -d'/' -f1)"
    
    1. Use aws cli for upload to s3
    aws s3 cp simulation.log s3://my-bucket/