So i have to Log my Jenkins Job Console Output to S3 Bucket and this involves many jobs to be configured in a way such that the console output log of the Jenkins job is pushed to S3 post build.
Log Jenkins Console Output to S3
3.1k Views Asked by Ramakrishnan_S At
2
There are 2 best solutions below
0
MaratC
On
See tee in Utility steps:
script {
tee("$WORKSPACE/my_output.txt") {
sh "echo Hello"
}
}
You may then upload the results to s3:
def path = env.JOB_NAME.replace('%2F','-').replace('/', "-").replace('_', "-").toLowerCase()
withAWS(endpointUrl:"...", credentials:"...") {
s3Upload bucket: "jenkins",
path:"${path}/${env.BUILD_NUMBER}/",
file: "my_output.txt",
workingDir: "${env.WORKSPACE}"
}
Related Questions in JENKINS
- Shellscript touch command not working in jenkins pipeline
- Jenkins Docker Agent Configuration Issue: Connection Refused on Local Ubuntu Install
- How to add more input text box in dynamicreferenceparameter in jenkins
- Jenkins pipeline script: Accept merge request from Gitlab
- Jenkins Exec Format Error while cloning repo
- Post checkmarx scan weblink on the Jenkins Build status page
- Exclude a file from merging to the main branch
- Created Jenkins pipeline and added the script in the Pipeline Description.To check out the Project from the svn repository.NotWorking. Any Suggestion
- How to write a Jenkins Pipeline script to fetch needed repo?
- trouble to trigger Jenkins job
- Unable to start jenkins in amazon linux 2: start request repeated too quickly
- is not a valid Cucumber report! String length (20054016) exceeds the maximum length (20000000)
- Run cleanup function in Python when Jenkins job is aborted
- Jenkins pipeline map is getting converted to an array but it's too large I think?
- How do I list which Jenkins credentials used per pipeline in the script console?
Related Questions in JENKINS-PIPELINE
- Shellscript touch command not working in jenkins pipeline
- How to add more input text box in dynamicreferenceparameter in jenkins
- Created Jenkins pipeline and added the script in the Pipeline Description.To check out the Project from the svn repository.NotWorking. Any Suggestion
- trouble to trigger Jenkins job
- Jenkins pipeline map is getting converted to an array but it's too large I think?
- How do I list which Jenkins credentials used per pipeline in the script console?
- How can i ignore a particular stage from the compilation tools (maven, java) which are configured globally
- How to use if statement between parameters in Jenkinsfile
- XrayImportBuilder adding new test cases to Test Execution instead of updating the existing test cases
- How do I mark my Jenkins build status based on cucumber scenarios pass percentage?
- How do i turn a build&test_job into a scripted pipeline as a jenkinsfile
- Jenkins-Pipeline, warnings-ng-plugin reports no workspace found
- Git diff command doesn't work with jenkins
- Jenkins job incorrectly connecting to localhost
- Jenkins pipeline build microservice
Related Questions in AWS-CLI
- How can I get the aws profile id from the aws configure sso command
- AWS Java SDK error: Unable to load credentials from any of the providers
- AWS sts error: The security token included in the request is expired
- macOS: aws cli Could not find executable named "groff"
- Add Cognito to Load Balancer Listener via AWS CLI
- Cognito user pool creation with MFA (TOTP) required via CLI
- Set password policy for AWS Cognito with AWS CLI
- Install AWS cli on lambda function with custom runtime
- Pipe aws output to jq will not result in array
- deleting all old ecr images for a particular branch
- How to retrieve details of a specific schedule using AWS CLI?
- How does one use Docker DIND and AWS CLI together as a service
- aws s3 cp emr stdout.gz file as txt encoding issue
- EC2 cannot access S3 in the same account with proper IAM role
- Pip dependeny issue while tring to host with AWS beanstalk
Related Questions in JENKINS-JOB-DSL
- Jenkins parametrized job failed "Connection to remote server failed [403], waiting to retry - 10 seconds until next attempt"
- Multibranch pipelines not working if it's created by job DSL
- Can I create a new Jenkins executor node or provide user/password to an existing node?
- Jenkins 502 Gateway error for organization folder
- Create a child job from a parent "seed" job with Job DSL
- Gradle Build Failing due to Environment Variables
- Testing DSL Scripts Using Gradle Failing
- A Jenkins job was manually configured from the web UI. How can I translate all the configuration details to a configuration-as-code file?
- Jenkins Jobs DSL groovy files require `this.method()` mysteriously when nothing changed
- Edit a file from Jenkins pipeline UI during pipeline execution
- jenkins job DSL from remote SCM
- change file parameter dynamically
- I was installing Jenkins and got this error
- Jenkins workspace directory verify if exist then build that project
- NoSuchMethodError: No such DSL method 'inline'
Related Questions in JENKINS-2
- Jenkins - trigger build only for new release branches
- wrong # args: should be "_o3 self class proc file optx opty"
- hudson.model.UpdateCenter#updateDefaultSite: Upgrading Jenkins. Failed to update the default Update Site 'default'. Plugin upgrades may fail
- Log Jenkins Console Output to S3
- How to use build parameters in the pieline.agent.node block of a Jenkinsfile?
- What is the meaning of "Projects tied to {node}" in Jenkins?
- 'Include' a shared library pipeline in other pipelines in the same shared library
- Jenkins2 - Getting error while trying to execute a Git command using 'Execute Shell'
- Jenkins upstreamProjects not starting jobs
- Build Pipeline Plugin - Jenkins - Showing only LAST Build Number of child job and only once (called from Post build action)
- Jenkins - Login Page shows up, but getting securityRealm / finishLogin ErrorID=e160bxxx-aaa-yyy-zzzz
- Why not running npm test on the docker image generated by skaffold?
- Jenkins Build Pipeline Plugin - DescriptorImpl checkbox
- Deploying war file in Tomcat Using Jenkins
- Where can I find DSL documentations for a Jenkins plugin?
Trending Questions
- UIImageView Frame Doesn't Reflect Constraints
- Is it possible to use adb commands to click on a view by finding its ID?
- How to create a new web character symbol recognizable by html/javascript?
- Why isn't my CSS3 animation smooth in Google Chrome (but very smooth on other browsers)?
- Heap Gives Page Fault
- Connect ffmpeg to Visual Studio 2008
- Both Object- and ValueAnimator jumps when Duration is set above API LvL 24
- How to avoid default initialization of objects in std::vector?
- second argument of the command line arguments in a format other than char** argv or char* argv[]
- How to improve efficiency of algorithm which generates next lexicographic permutation?
- Navigating to the another actvity app getting crash in android
- How to read the particular message format in android and store in sqlite database?
- Resetting inventory status after order is cancelled
- Efficiently compute powers of X in SSE/AVX
- Insert into an external database using ajax and php : POST 500 (Internal Server Error)
Popular # Hahtags
Popular Questions
- How do I undo the most recent local commits in Git?
- How can I remove a specific item from an array in JavaScript?
- How do I delete a Git branch locally and remotely?
- Find all files containing a specific text (string) on Linux?
- How do I revert a Git repository to a previous commit?
- How do I create an HTML button that acts like a link?
- How do I check out a remote Git branch?
- How do I force "git pull" to overwrite local files?
- How do I list all files of a directory?
- How to check whether a string contains a substring in JavaScript?
- How do I redirect to another webpage?
- How can I iterate over rows in a Pandas DataFrame?
- How do I convert a String to an int in Java?
- Does Python have a string 'contains' substring method?
- How do I check if a string contains a specific word?
One way is to simply upload logs file to s3 using AWS CLI. You can try below approach.
Or you can set cron job to sync local logs folder with s3.
for example, you can set cron job that will run every minutes and sync local log file to s3 or copy and have versioning on s3 side, or the other option is to trigger cronjob script after completion of each job.