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 Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jun 12, 2018 in Bitbucket

Do you use any Atlassian products for your personal projects?

After spinning my wheels trying to get organized enough to write a book for National Novel Writing Month (NaNoWriMo) I took my affinity for Atlassian products from my work life and decided to tr...

22,970 views 26 12
Join discussion

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