Does anyone know, How to get the project created event either through CLI or REST in STASH ?

I just wanted to filer or get the username and time who and when the project was created in STASH.

Appreciate your help.

Thanks

2 answers

1 accepted

0 vote
Ben Stuart Atlassian Team Apr 19, 2015

Hello,

I think the easiest method to find project creation events is to grep Stash's logs. If you navigate to <Stash_Home>/log and run the following command:

grep -H -r 'DefaultProjectService Created new project' atlassian-stash*.log

you should get an output similar to this: 

atlassian-stash.log:2015-04-19 13:54:53,662 INFO  [http-nio-7990-exec-10] &lt;USER&gt; @1RYJKG8x834x1177x0 byl6yc 127.0.0.1 "POST /projects HTTP/1.1" c.a.s.i.p.DefaultProjectService Created new project: (&lt;PROJECT_KEY&gt;) &lt;PROJECT_NAME&gt;

For each project created, you will see this line in atlassian-stash.log that contains: Project name, User that created the project, timestamp the project was created and the project key. 

Here is a sample for reference: 

atlassian-stash.log:2015-04-19 13:54:53,662 INFO  [http-nio-7990-exec-10] bstuart @1RYJKG8x834x1177x0 byl6yc 127.0.0.1 "POST /projects HTTP/1.1" c.a.s.i.p.DefaultProjectService Created new project: (CRIT) Critical

 

Hopefully that helps, let me know if you have any further questions!

Regards,
Ben Stuart

Thanks Ben. As you know, STASH logs are rolled every day and removed after a month or so. Hence, I will not be able to get the project created event for a project which is older than a month or so. Do you suggest any other approach ? Thanks !

I am sorry to ask you another question. Is there a way to search for a source file say 1.java across all repositories across all projects in STASH ? Thanks !

0 vote
Ben Stuart Atlassian Team Apr 21, 2015

If you need to find when all projects were created and by whom navigate to <Stash_Home>/log/audit and run the following command:

zgrep 'ProjectCreatedEvent' *.gz | gawk '{print $5 " - " strftime("%c", $7/1000) " - " $9}'

This will give you an output similar to this: 

bstuart - Sun Apr 19 13:54:53 2015 - CRIT

You may need to download gawk form this website: http://rudix.org/packages/gawk.html

I would also like to add that if you only need to find this information for one project you can do this from the UI as well by going to project settings >> audit log. This is the history of the project and if you go back far enough you should be able to see an entry for when the project was created and by whom. 

Regards,
Ben Stuart

 

Suggest an answer

Log in or Join to answer
Community showcase
Piotr Plewa
Published Dec 27, 2017 in Bitbucket

Recipe: Deploying AWS Lambda functions with Bitbucket Pipelines

Bitbucket Pipelines helps me manage and automate a number of serverless deployments to AWS Lambda and this is how I do it. I'm building Node.js Lambda functions using node-lambda&nbsp...

696 views 0 4
Read article

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you
Atlassian Team Tour

Join us on the Team Tour

We're bringing product updates and pro tips on teamwork to ten cities around the world.

Save your spot