Confluence CLI removeAttachmentVersions

H Leung August 5, 2016

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

1 vote
Answer accepted
Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 5, 2016

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.

 

H Leung August 8, 2016

Thanks Bob. That'd be very helpful.

Bob Swift OSS (Bob Swift Atlassian Apps)
Rising Star
Rising Star
Rising Stars are recognized for providing high-quality answers to other users. Rising Stars receive a certificate of achievement and are on the path to becoming Community Leaders.
August 8, 2016

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

Suggest an answer

Log in or Sign up to answer
TAGS
AUG Leaders

Atlassian Community Events