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
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] <USER> @1RYJKG8x834x1177x0 byl6yc 127.0.0.1 "POST /projects HTTP/1.1" c.a.s.i.p.DefaultProjectService Created new project: (<PROJECT_KEY>) <PROJECT_NAME>
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 !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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 !
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
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
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Online forums and learning are now in one easy-to-use experience.
By continuing, you accept the updated Community Terms of Use and acknowledge the Privacy Policy. Your public name, photo, and achievements may be publicly visible and available in search engines.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.