Confluence でもっともよく利用されているマクロの一覧を取得する方法

プラットフォームについて: Cloud と Data Center - この記事は クラウド プラットフォームとデータセンター プラットフォームの両方に等しく当てはまります。

Server* 製品のサポートは 2024 年 2 月 15 日に終了しました。Server 製品を実行している場合は、 アトラシアン Server サポート終了 のお知らせにアクセスして、移行オプションを確認してください。

*Fisheye および Crucible は除く

要約

Confluence 管理者が、ユーザーによってアクティブに利用されているマクロを把握するためにマクロの長期的な利用状況を監査したい場合があります。背景としては、Confluence プラグインの定期的なクリーンアップや、アップグレードの一貫としてのプラグイン (マクロを提供するもの) の評価などが考えられます。

ソリューション

Solution for Confluence Cloud and Confluence 5.10 (or later)

If you're using Confluence Cloud or Confluence 5.10 or later, go to ⚙ > General Configuration > Macro Usage to find out how often macros provided by particular add-ons (including bundled add-ons) are used in your site. We also list any add-ons that have macros that are not used on any pages in current spaces. This is useful if you're considering removing an add-on and want to check that you won't be causing 'unknown-macro' errors on pages in your site.

The above method has a known issue: The page does not show macro usage from the pages that the current user does not have view permission. CONFSERVER-60582

Solution for Confluence 5.9 and earlier

  1. Run the query in the Confluence Database:

    This SQL query will output the storage format of all current content (i.e. will not return historical pages) in Confluence that contains at least one macro. Given a large data set, this query can potentially take a long time. For this reason we strongly recommend running this query against a database cloned from production rather than the production database itself.

    Depending on how large your production DB is, the resulting file may easily have over 5GB. Make sure you have enough space on the file system to store it.

    SELECT bc.body FROM BODYCONTENT bc JOIN CONTENT c ON bc.contentid = c.contentid WHERE c.prevver IS NULL AND bc.body LIKE '%ac:structured-macro%';
  2. 結果を CSV ファイル (コンマ区切りファイル) としてエクスポートします。これはご利用のデータベース ツールを利用して行えます。

  3. 次に、Linux ターミナルまたは Cygwin で、生成済みの CSV ファイルに対して次のコマンドを実行します。

    awk 'BEGIN{FS=OFS=" ";}{for(i=1;i<=NF;i++){if($i~/<ac:structured-macro/){if($(i+1)~/ac:name/) {print $(i+1)} else {print $(i+2)} }}}' <filename> | cut -d"\"" -f3 | sort | uniq -c | sort -g

    Replace <filename> with the CSV file.

  4. これにより、次のような結果が得られます。

    22 recently-updated 19 column 9 panel 4 gallery 3 section 3 pagetree 2 gadget 1 viewfile 1 pagetreesearch 1 calendar

関連資料

更新日時: September 25, 2025

さらにヘルプが必要ですか?

アトラシアン コミュニティをご利用ください。