Illegal Search Terms
Several terms are illegal to use when searching Confluence, like : or {. If you search for just the macro term, you're likely not to get the right search results. For example, searching for 'usage', which is the name of a macro but also a common English word, will not yield an accurate count.
Query the Database
If, for example you want to search for the uses of the usage macro, you can search the database:
| For large instances of Confluence, searches across the entire bodycontent table of the database might be expensive. You can try this on a test server. |
| You might want to use the SQL Plugin to automate this, or better yet the Macro usage stats plugin. Note that these are third party (unsupported) plugins. |
SELECT * FROM BODYCONTENT WHERE BODY LIKE '%{usage}%'
If you want to get the last users or the creators of the pages where the noformat macro is used, you might run:
SELECT CREATOR FROM CONTENT WHERE CONTENTID IN (SELECT CONTENTID FROM BODYCONTENT WHERE BODY LIKE '%{noformat}%') GROUP BY CREATOR
SELECT LASTMODIFIER FROM CONTENT WHERE CONTENTID IN (SELECT CONTENTID FROM BODYCONTENT WHERE BODY LIKE '%{noformat}%') GROUP BY LASTMODIFIER
Logging Uses of a Macro
This information won't tell you how often a macro is invoked - rather how often it appears on pages. For counting how often it's invoked (and measuring the time it takes to invoke it), check Identifying Slow Performing Macros.
Counting the Incidents of Invoked Logs
You can then grep the logs like:
grep -c "{usage" atlassian-confluence.log






Comments (4)
Mar 13, 2009
Herman de Boer says:
Hi, this sounds hardly like an alternative. Why not make it possible to use esc...Hi,
this sounds hardly like an alternative. Why not make it possible to use escape characters for those characters?
Regards, Herman.
Mar 13, 2009
Cheryl Jerozal says:
Hi Herman~ You'll probably want to create an issue for your request in the Conf...Hi Herman~
You'll probably want to create an issue for your request in the Confluence project, so that the product team is aware of it and you can watch for progress. I did a quick search and didn't see this request there already.
~Cheryl
Mar 26, 2009
Betsy Walker says:
We've found it useful to run queries like this, exporting the results to Excel t...We've found it useful to run queries like this, exporting the results to Excel that we can pass on to Space Administrators. It's especially helpful if we include the Space Name or Space Key plus a URL to launch the page in view or edit mode. Adding the check for content_status eliminates deleted pages from the results.
The following works for Microsoft SQL Server 2000 and 2005:
SELECT DISTINCT S.spacename, C.title, 'http://yourbaseurlgoeshere/display/' + S.spacekey + '/' + REPLACE(C.title,' ','+') AS PageURL FROM content C INNER JOIN spaces S ON C.spaceid = S.spaceid LEFT OUTER JOIN bodycontent B ON C.contentid = B.contentid WHERE C.contenttype = 'PAGE' AND content_status = 'current' AND B.body LIKE '%{noformat}%' ORDER BY S.spacename, C.title GOSep 04
Mitch Abramson says:
For Confluence 3.0.1 - I have tested searches using online Confluence Search fea...For Confluence 3.0.1 - I have tested searches using online Confluence Search feature using "{myMacro}" and been successful at returning content using a macro. In particular, I have done searches based on "{HTMLComment}Standard Comment I embed in Certain Types of Pages{HTMLComment}" and "{include:Name of Reused Document}" to help manage re-used content. I believe this page may be a bit out of date for version 3.0.1. To do this, I simply escaped the curly brases with the slash character.
FYI - some of us work for corporations whose security policies prevent us from having sequel access to systems we administrate, so solutions that can be implimented based solely on built-in features are preferred.
Add Comment