connectapi icon indicating copy to clipboard operation
connectapi copied to clipboard

New Article - Posit Connect Audit tasks?

Open slodge opened this issue 2 years ago • 1 comments

Looking at the articles on Posit support like https://support.posit.co/hc/en-us/articles/360007435274-Counting-Named-Users-in-Posit-Connect-and-Posit-Workbench-RStudio-Server-Pro, it would be useful to us to have connectapi equivalents.

For example:

library(tidyverse)
library(connectapi)

client <- connect(
  host = Sys.getenv("CONNECT_PROD_SERVER"),
  api_key = Sys.getenv("CONNECT_PROD_API")
)

audit <- connectapi::get_audit_logs(client, limit = 1000000)

most_recent_users <-
  audit %>% 
  filter(user_id > 0) %>% # removes e.g. "Obsolete rendering remover" and "Auth Provider"
  group_by(user_id, user_description) %>% 
  summarise(
    MostRecent = max(time)
  ) %>% 
  arrange(desc(MostRecent)) %>% 
  filter(MostRecent > lubridate::today("UTC") - lubridate::years(1)) 

most_recent_users %>% 
  View()

Are the vignettes/pkgdown docs for this package a good place (the right place) for these? If so, we can look at helping with PRs.

slodge avatar Mar 02 '23 11:03 slodge

I like it!! vignettes / pkgdown contributions are definitely welcome if you are so inclined!

It's a bit tricky to use, but there is a test Connect deployment that is set up during the pkgdown site generation, so some of this could be generated programmatically.

There are also a bunch of "audit reports" here on our "solutions site," which may be somewhat up your alley. Unfortunately, many of them do not use connectapi IIRC

https://solutions.posit.co/operations/connect-apis/basic-audit-report/

colearendt avatar May 15 '23 19:05 colearendt