Confluence CLI removeAttachmentVersions

Hi,

 

One of our confluence users has an automated process that uploads a file to a confluence page and calls the CLI command removeAttachmentVersions with the -limit option to limit the number of versions of an attachment to 3. This is the line that that makes this call:

 

confluence --server svr --password "pwd" --user "userxyz" --action removeAttachmentVersions --space "~userxyz" --title "Test Attachment Versions" --name "test.txt" --limit 3

 

While this is working fine, the CLI command generates 3 lines of message in atlassian-confluence.log for every older version of attachment does not exist (they were removed by this automated process previously when the last version was uploaded):

 

2016-08-04 15:36:28,613 INFO [http-bio-8090-exec-52] [confluence.rpc.auth.TokenAuthenticationInvocationHandler] invokeAuthenticatedMethod Executing remote API method [ getAttachment ] as user [ userxyz ]

2016-08-04 15:36:28,618 WARN [http-bio-8090-exec-52] [confluence.rpc.auth.TokenAuthenticationInvocationHandler] invokeAuthenticatedMethod Failure executing remote method [getAttachment]: No attachment on content with id 16253054, name 'test.txt' and version 837 exists.
-- url: /rpc/soap-axis/confluenceservice-v2 | userName: userxyz | method: getAttachment

(*** the above msgs repeat from version 837 down to 1 ***)

 

This is not a problem initially, when the current version of attachment is small (e.g. 5). But as the current attachment version is getting bigger and bigger, a lot of warning messages will build up in the log. For example, if the current attachment version is 3000, the log will be filled with warning message from version 2997 to 1 (total of 3*2997 lines of messages). The problem is getting worse each day since the attachment is updated a few times per day.

 

Is there a way to resolve this issue or, at least, to suppress this particular warning message? The --quiet option doesn't seem to help. I'm testing it on Confluence version 5.6.3, CLI version 5.2.0. Thanks.

1 answer

1 accepted

There are 2 problems.

  1. Confluence doesn't provide a way for us to list the attachment versions. Therefore we have to use trial and error to make sure we remove all the versions requested. Therefore we may make delete requests that are not valid.
  2. Apparently, Confluence is logging these invalid requests.

There are a couple of things you can do to mitigate the problems:

  1. Reduce the logging level to avoid logging those warnings.
  2. Occasionally, delete the attachment completely (like weekly or monthly) so that highest version number remains relatively low reducing then number of invalid requests that need to be made.

I have created an improvement request to make the situation better, but, it may have to wait until a Confluence version that supports better REST APIs to access the version information - CSOAP-574.

 

Thanks Bob. That'd be very helpful.

CSOAP-574 has been resolved with a patch that avoids this scenario.

Suggest an answer

Log in or Sign up to answer
How to earn badges on the Atlassian Community

How to earn badges on the Atlassian Community

Badges are a great way to show off community activity, whether you’re a newbie or a Champion.

Learn more
Community showcase
Posted Jul 10, 2018 in Confluence

We want to see the templates you've created in Confluence!

Hi Community, Jessica here from the Confluence Product Marketing team!  July’s community challenge is all about sharing pictures  — and as an extension of our first post on what ...

915 views 23 12
Join discussion

Atlassian User Groups

Connect with like-minded Atlassian users at free events near you!

Find a group

Connect with like-minded Atlassian users at free events near you!

Find my local user group

Unfortunately there are no AUG chapters near you at the moment.

Start an AUG

You're one step closer to meeting fellow Atlassian users at your local meet up. Learn more about AUGs

Groups near you