wiki:TracQuery

Version 3 (modified by trac, 7 years ago) ( diff )

--

Trac Ticket Queries

In addition to reports, Trac provides support for custom ticket queries, which can be used to display tickets that meet specified criteria.

To configure and execute a custom query, switch to the View Tickets module from the navigation bar, and select the Custom Query link.

Filters

When you first go to the query page, the default filter will display tickets relevant to you:

  • If logged in then all open tickets, it will display open tickets assigned to you.
  • If not logged in but you have specified a name or email address in the preferences, then it will display all open tickets where your email (or name if email not defined) is in the CC list.
  • If not logged in and no name/email is defined in the preferences, then all open issues are displayed.

Current filters can be removed by clicking the button to the left with the minus sign on the label. New filters are added from the dropdown lists at the bottom corners of the filters box; 'And' conditions on the left, 'Or' conditions on the right. Filters with either a text box or a dropdown menu of options can be added multiple times to perform an Or on the criteria.

For text fields such as Keywords and CC the - operator can be used to negate a match and double quotes (since 1.2.1) can be used to match a phrase. For example, a contains match for word1 word2 -word3 "word4 word5" matches tickets containing word1 and word2, not word3 and word4 word5.

You can use the fields just below the filters box to group the results based on a field, or display the full description for each ticket.

After you have edited your filters, click the Update button to refresh your results.

Keyboard shortcuts are available for manipulating the checkbox filters:

  • Clicking on a filter row label toggles all checkboxes.
  • Pressing the modifier key while clicking on a filter row label inverts the state of all checkboxes.
  • Pressing the modifier key while clicking on a checkbox selects the checkbox and deselects all other checkboxes in the filter. Since 1.2.1 this also works for the Columns checkboxes.

The modifier key is platform and browser dependent. On Mac the modified key is Option/Alt or Command. On Linux the modifier key is Ctrl + Alt. Opera on Windows seems to use Ctrl + Alt, while Alt is effective for other Windows browsers.

Clicking on one of the query results will take you to that ticket. You can navigate through the results by clicking the Next Ticket or Previous Ticket links just below the main menu bar, or click the Back to Query link to return to the query page.

You can safely edit any of the tickets and continue to navigate through the results using the Next/Previous/Back to Query links after saving your results. When you return to the query any tickets which were edited will be displayed with italicized text. If one of the tickets was edited such that it no longer matches the query criteria , the text will also be greyed. Lastly, if a new ticket matching the query criteria has been created, it will be shown in bold.

The query results can be refreshed and cleared of these status indicators by clicking the Update button again.

Saving Queries

Trac allows you to save the query as a named query accessible from the reports module. To save a query ensure that you have Updated the view and then click the Save query button displayed beneath the results. You can also save references to queries in Wiki content, as described below.

Note: one way to easily build queries like the ones below, you can build and test the queries in the Custom report module and when ready - click Save query. This will build the query string for you. All you need to do is remove the extra line breaks.

Note: you must have the REPORT_CREATE permission in order to save queries to the list of default reports. The Save query button will only appear if you are logged in as a user that has been granted this permission. If your account does not have permission to create reports, you can still use the methods below to save a query.

You may want to save some queries so that you can come back to them later. You can do this by making a link to the query from any Wiki page.

[query:status=new|assigned|reopened&version=1.0 Active tickets against 1.0]

Which is displayed as:

Active tickets against 1.0

This uses a very simple query language to specify the criteria, see Query Language.

Alternatively, you can copy the query string of a query and paste that into the Wiki link, including the leading ? character:

[query:?status=new&status=assigned&status=reopened&group=owner Assigned tickets by owner]

Which is displayed as:

Assigned tickets by owner

Customizing the table format

You can also customize the columns displayed in the table format (format=table) by using col=<field>. You can specify multiple fields and what order they are displayed in by placing pipes (|) between the columns:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter)]]

This is displayed as:

Results (1 - 3 of 1453)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#1943 invalid Add Sandisk Cruzer to database Phillip Link
#1939 invalid Warning! SMART Attribute Thresholds Structure error: invalid SMART checksum Tony__T
#1935 duplicate Problems with S.M.A.R.T (OMV - Short self-test on /dev/nvme0n1) NicolaiW
1 2 3 4 5 6 7 8 9 10 11

Full rows

In table format you can also have full rows by using rows=<field>:

[[TicketQuery(max=3,status=closed,order=id,desc=1,format=table,col=resolution|summary|owner|reporter,rows=description)]]

This is displayed as:

Results (1 - 3 of 1453)

1 2 3 4 5 6 7 8 9 10 11
Ticket Resolution Summary Owner Reporter
#1943 invalid Add Sandisk Cruzer to database Phillip Link
Description
smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.12.12+bpo-amd64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Vendor:               SanDisk
Product:              Cruzer Blade
Revision:             1.00
Compliance:           SPC-4
User Capacity:        31 406 948 352 bytes [31,4 GB]
Logical block size:   512 bytes
Serial number:        4C530000230711118562
Device type:          disk
Local Time is:        Sun Mar 23 22:05:43 2025 CET
SMART support is:     Available - device has SMART capability.
SMART support is:     Enabled
Temperature Warning:  Disabled or Not Supported
Read Cache is:        Enabled
Writeback Cache is:   Disabled

=== START OF READ SMART DATA SECTION ===
SMART Health Status: OK
Current Drive Temperature:     0 C
Drive Trip Temperature:        0 C

Error Counter logging not supported

Device does not support Self Test logging
Device does not support Background scan results logging
#1939 invalid Warning! SMART Attribute Thresholds Structure error: invalid SMART checksum Tony__T
Description

Warning! SMART Attribute Thresholds Structure error: invalid SMART checksum

I purchased a new WD Red Plus from Amazon and received this warning. Returned and bought another direct from Western Digital and received the same warning on the 2nd drive. The WD Red Plus that I have from a year ago does not receive this warning, so I suspect that WD made a change to the firmware

Attached are output from 'smartctl -x -a /dev/sdX' and 'smartctl -r ataioctl,2 -A /dev/sdX'

I realize that this is just a warning and as a long test completes without error I can just ignore it, but still thought this was worth a ticket

#1935 duplicate Problems with S.M.A.R.T (OMV - Short self-test on /dev/nvme0n1) NicolaiW
Description

Hello everyone, for some time now, Open Media Vault has been sending me the following error message:

This message was generated by the smartd daemon running on:

host name: omv-nas
DNS domain: local

The following warning/error was logged by the smartd daemon:

Device: /dev/disk/by-id/nvme-CT4000P3SSD8_2342E88107D9, number of Error Log entries increased from 9 to 10

Device info:
CT4000P3SSD8, S/N:2342E88107D9, FW:P9CR30A, NSID:1

For details see host's SYSLOG.

You can also use the smartctl utility for further investigation.
The original message about this issue was sent at Mon Feb 10 14:32:12 2025 CET
Another message will be sent in 24 hours if the problem persists.

When I try to run a "Short self-test" on the "/dev/nvme0n1" manually, omv outputs the following:

smartctl 7.3 2022-02-28 r5338 [x86_64-linux-6.12.9+bpo-amd64] (local build)
Copyright (C) 2002-22, Bruce Allen, Christian Franke, http://www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Number: CT4000P3SSD8
Serial Number: 2342E88107D9
Firmware Version: P9CR30A
PCI Vendor/Subsystem ID: 0xc0a9
IEEE OUI Identifier: 0x00a075
Controller ID: 1
NVMe Version: 1.4
Number of Namespaces: 1
Namespace 1 Size/Capacity: 4,000,787,030,016 [4.00 TB]
Namespace 1 Formatted LBA Size: 512
Namespace 1 IEEE EUI-64: 6479a7 8440000039
Local Time is: Tue Feb 18 15:25:34 2025 CET
Firmware Updates (0x12): 1 Slot, no Reset required
Optional Admin Commands (0x0017): Security Format Frmw_DL Self_Test
Optional NVM Commands (0x005e): Wr_Unc DS_Mngmt Wr_Zero Sav/Sel_Feat Timestmp
Log Page Attributes (0x06): Cmd_Eff_Lg Ext_Get_Lg
Maximum Data Transfer Size: 64 Pages
Warning Comp. Temp. Threshold: 85 Celsius
Critical Comp. Temp. Threshold: 95 Celsius

Supported Power States
St Op Max Active Idle RL RT WL WT Ent_Lat Ex_Lat
0 + 6.00W 0.0000W - 0 0 0 0 0 0
1 + 3.00W 0.0000W - 0 0 0 0 0 0
2 + 1.50W 0.0000W - 0 0 0 0 0 0
3 - 0.0250W 0.0000W - 3 3 3 3 5000 1900
4 - 0.0030W - - 4 4 4 4 13000 100000

Supported LBA Sizes (NSID 0x1)
Id Fmt Data Metadt Rel_Perf
0 + 512 0 1
1 - 4096 0 0

=== START OF SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

SMART/Health Information (NVMe Log 0x02)
Critical Warning: 0x00
Temperature: 41 Celsius
Available Spare: 100%
Available Spare Threshold: 5%
Percentage Used: 0%
Data Units Read: 209,028 [107 GB]
Data Units Written: 340,472 [174 GB]
Host Read Commands: 535,891
Host Write Commands: 705,317
Controller Busy Time: 10
Power Cycles: 7
Power On Hours: 190
Unsafe Shutdowns: 0
Media and Data Integrity Errors: 0
Error Information Log Entries: 10
Warning Comp. Temperature Time: 0
Critical Comp. Temperature Time: 0
Temperature Sensor 1: 41 Celsius
Temperature Sensor 2: 57 Celsius
Temperature Sensor 8: 41 Celsius

Error Information (NVMe Log 0x01, 16 of 16 entries)
Num ErrCount SQId CmdId Status PELoc LBA NSID VS
0 10 0 0x4010 0x4005 0x028 0 0 -

Everything works perfectly with the SSD hard drive.

I'm still a bit of a newbie on this topic and would really appreciate some help with this problem.

1 2 3 4 5 6 7 8 9 10 11

Query Language

query: TracLinks and the [[TicketQuery]] macro both use a mini “query language” for specifying query filters. Filters are separated by ampersands (&). Each filter consists of the ticket field name, an operator and one or more values. More than one value are separated by a pipe (|), meaning that the filter matches any of the values. To include a literal & or | in a value, escape the character with a backslash (\).

The available operators are:

= the field content exactly matches one of the values
~= the field content contains one or more of the values
^= the field content starts with one of the values
$= the field content ends with one of the values

All of these operators can also be negated:

!= the field content matches none of the values
!~= the field content does not contain any of the values
!^= the field content does not start with any of the values
!$= the field content does not end with any of the values

Filters combining matches and negated matches can be constructed for text fields such as Keywords and CC when using the contains (~=) operator. The - operator is used to negate a match and double quotes (since 1.2.1) are used for whitespace-separated words in a phrase. For example, keywords~=word1 word2 -word3 "word4 word5" matches tickets containing word1 and word2, not word3 and also word4 word5.

status=closed,keywords~=firefox query closed tickets that contain keyword firefox
status=closed,keywords~=opera query closed tickets that contain keyword opera
status=closed,keywords~=firefox opera query closed tickets that contain keywords firefox and opera
status=closed,keywords~=firefox|opera query closed tickets that contain keywords firefox or opera
status=closed,keywords~=firefox,or,keywords~=opera query closed tickets that contain keyword firefox, or (closed or unclosed) tickets that contain keyword opera
status=closed,keywords~=firefox -opera query closed tickets that contain keyword firefox, but not opera
status=closed,keywords~=opera -firefox query closed tickets that contain keyword opera, but no firefox

The date fields created and modified can be constrained by using the = operator and specifying a value containing two dates separated by two dots (..). Either end of the date range can be left empty, meaning that the corresponding end of the range is open. The date parser understands a few natural date specifications like "3 weeks ago", "last month" and "now", as well as Bugzilla-style date specifications like "1d", "2w", "3m" or "4y" for 1 day, 2 weeks, 3 months and 4 years, respectively. Spaces in date specifications can be omitted to avoid having to quote the query string.

created=2007-01-01..2008-01-01 query tickets created in 2007
created=lastmonth..thismonth query tickets created during the previous month
modified=1weekago.. query tickets that have been modified in the last week
modified=..30daysago query tickets that have been inactive for the last 30 days

Note that modified is the last modified time, so modified with a date range shows ticket that were last modified in that date range. If a ticket was modified in the date range, but modified again after the end date, it will not be included in the results.


See also: TracTickets, TracReports, TracGuide, TicketQuery

Note: See TracWiki for help on using the wiki.