Log for previous pipeline deployments.
Asked by Tuan Nguyen Anh:

Hello,

In bitbucket pipeline, I can see the logs of latest deployment but I cannot find out the logs of previous deployments (included failed ones).

Do we have a place to store them on BB or please guide me how to get them.

It's a very useful feature on BB if we have it.

Thanks,

Tuan


Answers:
author: Abhishek Sharma
body: after a long time I am facing this issue when tracking logs of the failed step which later got succeeded, any success so far for you to find those lost logs?


author: Ljubica Kostova
body: I need the same,   

My deployment step failed, after redeploy (only them failed step) the old logs are gone :(  

It is very useful for investigation to not overridde them


author: Peter
body: We need this to be view previous deployment as well for root cause analysis, audit trails etc.


author: ktomk
body: All deployment logs including past ones should be available. You can either access them by locating the pipeline build under pipelines or by browsing through the deployments under deployments.

The history on the deployments UI might be a little slow / hard to use, but apart from that I never had problems to access old pipelines logs.

comments: author: Tuan Nguyen Anh
body: Hi ktomk,

I think you mis-understand my case here.

For example, you have a PR and that PR failed to run. After fixing it, you rerun the pipeline, and you cannot see the logs of previous trigger.

It's my case, not the previous commit or PR.


author: ktomk
body: [@Tuan Nguyen Anh](/t5/user/viewprofilepage/user-id/4109253) Yes, I'm not so sure, as what I mentioned is less about a previous commit (which might be deleted by now) or previous PR. You can find all logs of all past pipelines under the pipelines section ordered by date.

Even if a log has been explicitly deleted (which is possible but normally not the case), the previous pipelines run (of any kind of trigger, be it push of a branch or tag \[named ref\] or a pull request \[or multiple triggers at once with one push\]) is still documented and available (in case of log deletion, just the log is missing, but all the other meta-data is still there, otherwise you see the log as the pipeline has run back then).

Maybe a screenshot helps?!:

![ktomk - pipelines - Pipelines ? Bitbucket - Chromium_082.png](https://community.atlassian.com/t5/image/serverpage/image-id/112846iEF093F7632A4B54B/image-dimensions/491x326?v=v2 "ktomk - pipelines - Pipelines ? Bitbucket - Chromium_082.png")

*(Bitbucket Pipelines within the Atlassian Bitbucket Cloud Browser Console)*

Clicking of any of the pipelines in the list (2) brings you to the pipeline run (identified by build number) where you also find the logs.


author: Tuan Nguyen Anh
body: Hi [@ktomk](/t5/user/viewprofilepage/user-id/3678912) ,

The pipeline #153 failed 4 days ago, and the log mentioned about python issues. My teammate clicked Redeploy yesterday, It worked. He told me that was the issue of BB image.

I want to check the SHA string of the image but I forgot to save the log of previous trigger and I have no information to compare it![BB1.png](https://community.atlassian.com/t5/image/serverpage/image-id/112851iB4DDBCBF787869F9/image-size/large?v=v2&px=999 "BB1.png")![BB2.png](https://community.atlassian.com/t5/image/serverpage/image-id/112852i65C969E541BBEB84/image-size/large?v=v2&px=999 "BB2.png")


author: ktomk
body: Ah, I see. This is re-run/re-deploy on a failed step only. This won't trigger a new build (number) and the logs are gone.

If you want to retain the log, re-run the entire pipeline. This gives a new build with it's own log.

I know this is not what you're currently looking for, retaining logs for each step run is not available on the UI and the REST API, albeit there is some fractal of obtaining logs per step run:

* [/2.0/repositories/{workspace}/{repo_slug}/pipelines/{pipeline_uuid}/steps/{step_uuid}/logs/{log_uuid}](https://developer.atlassian.com/bitbucket/api/2/reference/resource/repositories/%7Bworkspace%7D/%7Brepo_slug%7D/pipelines/%7Bpipeline_uuid%7D/steps/%7Bstep_uuid%7D/logs/%7Blog_uuid%7D)

Sadly, I don't know where to obtain the \`{log_uuid}\` part and also the endpoint gives errors only to me and it is undocumented.


author: Tuan Nguyen Anh
body: After a day search for it, I think it's the limitation of BB. Hope we can have this feature to trace the issues.

Thanks!

comments: author: Peter
body: We need this as well.


author: Kristian Luck
body: We need this as well. Based on [@ktomk](/t5/user/viewprofilepage/user-id/3678912) finding of a ..../logs/{log_uuid}, it would seem that under the covers there may be a historical record of previous step logs.  

Anyone have an update on this? Is there a requested feature enhancement logged? I don't mind resorting to using the APIs directly if the dashboard doesn't have a UI for it.


Tags: bitbucket-pipelines

cloud