forked from awslabs/mountpoint-s3
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Save associated binary for core dump (awslabs#896)
* Save associated binary for core dump To be able to analyze the core dump we also need the binary it was generated from. This adds a new script for uploading the binary associated with the core dump when tests are failing in the CI. Signed-off-by: Monthon Klongklaew <monthonk@amazon.com> * Update core dump pattern Signed-off-by: Monthon Klongklaew <monthonk@amazon.com> --------- Signed-off-by: Monthon Klongklaew <monthonk@amazon.com>
- Loading branch information
Showing
2 changed files
with
24 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
#!/bin/bash | ||
|
||
bucket_name=$S3_BUCKET_NAME | ||
bucket_prefix=$S3_BUCKET_TEST_PREFIX | ||
coredump_path=/var/lib/systemd/coredump/ | ||
coredump_pattern=core.* | ||
|
||
# upload core dump files to S3 | ||
aws s3 cp ${coredump_path} s3://${bucket_name}/${bucket_prefix}coredump/ --recursive --exclude "*" --include "${coredump_pattern}" | ||
|
||
# get all core dump records to find their associated binary files | ||
coredump_records=`coredumpctl --no-legend | awk '{print $5,$10}'` | ||
|
||
while IFS= read -r line; do | ||
# get the pid to help matching it with the core dump | ||
pid=`echo $line | awk '{print $1}'` | ||
binary_path=`echo $line | awk '{print $2}'` | ||
binary_name=$(basename $binary_path) | ||
# upload each binary to S3 | ||
aws s3 cp ${binary_path} s3://${bucket_name}/${bucket_prefix}binary/${pid}_${binary_name} | ||
done <<< "$coredump_records" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters