Fetch worklog results of a particular user - jira

I want to get the total hours that every user has logged in, in a specific project every week.
In order to achieve this, I'm trying to get the whole worklog in the project, and then filter it by the worklog Author. This is the query I'm using:
https://jira.example.com/rest/api/2/search?startIndex=0&maxResults=100&jql=project=%27Test%20Project%27+and+worklogAuthor=testUser+and+updated%3E=-7d&fields=worklog
This brings back every issue that has been updated in the last 7 days, and the user is related to it. However, it also brings back the worklog of another user that has added time in the same issue for example.
My question is the following, is there a way to filter the query by name, and bring back the worklog of a particular user, without the worklogs of other users that are simply related to the same issue?
The query returns the results in a json format that look like this for every worklog of a user:
"worklogs": [
{
"author": {...}, // 8 items, where there's a 'name' field for the particular user
"updateAuthor": {...}, // 8 items
"comment": "",
"created": "2018-01-03T13:42:15.000+0200",
"updated": "2018-01-03T13:42:15.000+0200",
"started": "2018-01-03T13:42:00.000+0200",
"timeSpent": "1h",
"timeSpentSeconds": 3600,
"id": "10540",
"issueId": "10674"
},
Thanks

I don't think this is possible with jira out of the box. The jira rest api only supports retrieving work logs for issues, not users.
However, there are add-ons like Script Runner that provide additional JQL functions that allow you to query for issues where a specific user has logged work. You can easily execute such a JQL using the search REST API. This will give you a smaller list of issues/work logs to filter on.
Example JQL:
issueFunction in workLogged(on "2015/07/28" by admin)
More info about custom jql functions is available in the Script Runner documentation.

worklogAuthor = currentUser()
or
worklogAuthor = marc
might help you

Related

JQL to Identify Time Logged by Individual

Good morning! I've come across a few answers but maybe there's an update. Is there a way to query the time logged by a specific user in Jira? I've tried
worklogauthor() = {user}
but the resulting Time Spent field brings back all the time logged, not just the time logged by the specific user entered.
Any ideas? I know there are add-ons with this information but if there's a way to get the same information through JQL and a dashboard gadget, that would be the preference - thanks!
Please try following JQL
issuefunction in workLogged("by username")
It can be filtered additionally by adding after date:
issuefunction in workLogged("by username after 2021/12/01")
or even narrowing it to specific period (before date)
issuefunction in workLogged("by username after 2021/12/01 before 2022/01/01")

How do I search for logs with values in an array in Datadog?

{
dd {
service cm-api
},
level: INFO,
product_ids: [
4105428,
4105429,
4105430,
4105431,
],
time: 2021-11-20T22:45:11.733088+00:00
}
I want to find all logs that have a certain product_id in them. I want something like (in pseudo-code) #product_ids.contains(4105428). I have tried #product_ids:5845542 but I don't get back logs that have this number in them.
Have you added a Facet to product_ids already? If a field isn't faceted, then it's not readily searchable.
It's usually simplest to view a log entry with the product_ids value and click it, the popup should show "Create facet for product_ids" and then any new logs with that value will be searchable from that point forward.
Read more on Facets: https://docs.datadoghq.com/logs/explorer/facets/
Once it's faceted and searchable, you should be able to use the search syntax you've tried.
More examples: https://docs.datadoghq.com/logs/explorer/search_syntax/#arrays

Jira JQL operator and + and + and

please I want to create a filter of custom statuses, but somehow when I press search I will get no results. When I search only for one status all is fine, but I want to merge that somehow into one filter. Or is there any way to get a exact number of tasks in any kind of status, assigned to the user? Im using the pie chart and want to see the number of all tasks assigned for any guy in the team, no matter the status. And I want to have it in a gadget. Thanks
Code Im using is:
project = "XYZ" AND status = "To Do" AND status = "Awaiting Approval"
AND status = "In Progress"
Have you looked at the 'in' operator?
...AND status IN ('To Do','Awaiting Approval','In Progress')
A Jira ticket cannot have more than one status at the time. I would do something like this
project = "XYZ" AND status IN ("To Do", "Awaiting Approval", "In Progress")
The other answers are definitely the correct way to write the JQL you were aiming to write, however I believe there is a better solution to your actual aim.
From what I understand, you want to see any Jira issue which is not closed and is assigned to a particular user. In this case I think the best solution would not to find all issues in the specific "open" statuses, but instead to find all which are not closed.
The best way to do this is by filtering by the status-category, as this will ensure the JQL works for all workflows, regardless of what their done/closed statuses are called.
statuscategory != done AND assignee=<user>
Replace <user> with the user you want to filter for, or currentUser() to automatically get the user who is running the query.
Documentation (only mentioned briefly): https://support.atlassian.com/jira-software-cloud/docs/advanced-search-reference-jql-fields/#Advancedsearchingfieldsreference-ResolutionResolution

Query/filter to return child issues from a list of active parents (EPICs)

I'm looking for a JQL query/filter to return a list of child issues from a list of active parents (EPICs).
For example:
"Epic Link" IN linkedIssuesInQuery("issueType = Epic AND Status = 'In Progress'")
I was hoping the above query would work, but the results are not what I expected. Is there a way in standard JIRA (no plugin) to return a list of all child issues of a Query/Filter set?
I also tried a filter, but the results were the same as above:
"Epic Link" IN linkedIssuesInFilter("1234")
// Where Filter Id 1234 was something like => issueType = Epic AND Status = 'In Progress'
Both examples above return results, however they seem to be incomplete results and I don't understand why some issues not not being returned.
ps. The function childIssuesOf("ABC-123") returns the correct results for a single parent issue, but how do I provide a dynamic list of parents, not just a static hardcoded issue number?
EDIT:
After a lot more experimenting and reading, I found that the JIRA instance I am using has a Plugin called JQL Tricks. This Plugin has a function which, based on its description, is exactly what I need: parent(JqlQuery) ... but it doesn't work!
Here is my test query:
issue in parent("project in (MyProject) and status = \"In Progress\" and issueType = EPIC")
This query returns 0 results! However when I cut out the JqlQuery within parent and run it on its own, I get the complete list of EPIC's I expect to see and when I review the EPIC's they all have child issues. From all the experimenting I have done with this function, I believe there is an issue with the status "In Progress" (and also "Open") as when I try the call with other status types the child issues are return as expected. I have also tried a different approach for filtering for In Progress
issue in parent("project in (MyProject) and status not in (closed, refused, new, open) and issueType = EPIC")
However the result is exactly the same as above, 0 results!
Finally I have also experimented with the function subtask(JqlQuery), also without success.
Can anyone help?
In JQL Tricks, parent and subtask JQL functions work with parent/child (subtask) link type. You might want to search for "issues in Epic" link type, i.e. using the "Epic Link" field.
With JQL Tricks you can try this (be careful about different quotation marks):
issue in issuesWhereEpicIn('project in (MyProject) AND status = "In Progress"')
Source: https://www.j-tricks.com/jql-tricks-plugin.html [1, 2]
Tip: (mainly for other users ended here finding the same answer)
You can also check if ScriptRunner add-on is installed (it's very often installed, too). You can check the presence if issueFunction is available in JQL). With this add-on, you can use this:
issueFunction in issuesInEpics('project in (MyProject) AND status = "In Progress"')

Jira / Cards assigned to a user in a given timeframe

We use Jira extensively in our project, and I am attempting to create some custom reports which should list all cards assigned to a user within a given timeframe.
For example: Get all cards I worked on in August 2014.
Is that even possible without direct DB access?
P.S. I have tried playing with the update timestamp, yet it will then also list cards which were assigned to me anytime but not necessarily in the timeframe I am interested in. This will NOT work -->
assignee = currentUser() and updated > "2014/08/01" and updated < "2014/10/31"
Should be like:
assignee was currentUser() DURING ("2014/08/01", "2014/10/31")
From looking at the Advanced Searching documents.

Resources