Skip to main content
Announcements
Defect acknowledgement with Nprinting Engine May 2022 SR2, please READ HERE
cancel
Showing results for 
Search instead for 
Did you mean: 
weijietc
Partner - Contributor III
Partner - Contributor III

NPrinting Audit Logs

Hi All,

Is there anyway to capture NPrinting Audit Logs as details as possible? 

Audit Logs require what the users clicks or change in :

1. User login into NP Web Console

2. User login to newsstand

3. NPrinting Designer

Thanks.

15 Replies
Danijel
Partner - Creator III
Partner - Creator III

Hello all,

thanks for the info. Then it would make sense to wait for the February version.

But here I have the problem that I have never worked with the APIs, just do not know how they are written and how to use them.

Is there maybe a beginner course somewhere? 🙂

Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

@Danijel 

I am working now on the blog post which will cover exactly this - stay tuned. In a day or 2 you will have working example.

cheers

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
Lech_Miszkiewicz
Partner Ambassador/MVP
Partner Ambassador/MVP

I just put something together here: https://nprintingadventures.com/2021/02/06/nprinting-audit-logs/

hope it helps

cheers Lech, When applicable please mark the correct/appropriate replies as "solution" (you can mark up to 3 "solutions". Please LIKE threads if the provided solution is helpful to the problem.
rafalcqlik
Contributor III
Contributor III

Hi @Lech_Miszkiewicz

I'm trying to use your Nprinting.qvs script to pull audit data from Nprinting. It's working fine but there is that 1000 rows limit so I tried to download data in a loop. I noticed that in NPrinting_Audit_Data table, there is that totalItems field which seems to contain number of records in audit table. So I used that in my loop so pretty much it looks like this (trimmed it a little bit):

 

Spoiler

set vQueryOffset = 0;
Do

NPrinting_Audit_Data:
SQL SELECT
"totalItems",
"offset",
"limit",
"__KEY_data",
(SELECT
"id" AS "id_u1",
"userId",
"userName",
.
.
.
FROM JSON (wrap off) "data" PK "__KEY_data"
WITH
CONNECTION( URL "$(vURL_Audit)", HTTPHEADER "cookie" "$(vCookie)", QUERY "Limit" "$(vQueryLimit)", QUERY "Offset" "$(vQueryOffset)", QUERY "dataType" "NewsstandReport");
;

let vTotalItems = peek('totalItems',-1,'NPrinting_Audit_Data');
let vQueryOffset = $(vQueryOffset)+$(vQueryLimit);

Loop until vQueryOffset >= vTotalItems

 It works fine but I'm not getting all the records. For some reason I'm just getting records from yesterday (2021-05-25) and today (2021-05-26). And I know there are more because when I download log file using this URL: https://ServerName:4993/api/v1/audit/logs I can see records since 2021-05-21 (which is when I enabled audit in nprinting). What's wrong? How to build that CONNECTION string to get all records from db?

What's strange is when I add another parameter: QUERY "end" "2021-05-24T23:59:08Z" it gives me records from 2021-05-24 (still nothing from 2021-05-21 - 2021-05-23). I tried with "start" parameter and set it to 2021-05-01 but no change. Is there something like a default limit which returns just last 24h of data? Do I also need to add "start" and "end" parameters into my loop and fetch each day 1000 rows at a time and then go to next day?

I will try to build some extract to load that data incrementally and save into qvd but first I need to understand how that works...

@Ruggero_Piccoli maybe you will be able to help here as well?

Thanks!

Ruggero_Piccoli
Support
Support

Hi,

I think it is something related with the app you are using because Qlik NPrinting pages every 50 rows https://help.qlik.com/en-US/nprinting/May2021/APIs/NP+API/index.html?page=9 and the limit of the CSV is 2^20-1 = 1,048,575.

Best Regards,

Ruggero



Best Regards,
Ruggero
---------------------------------------------
When applicable please mark the appropriate replies as CORRECT. This will help community members and Qlik Employees know which discussions have already been addressed and have a possible known solution. Please mark threads with a LIKE if the provided solution is helpful to the problem, but does not necessarily solve the indicated problem. You can mark multiple threads with LIKEs if you feel additional info is useful to others.
rafalcqlik
Contributor III
Contributor III

Yeah, by default that limit is 50 but what @Lech_Miszkiewicz  figured out is that we can increase that up to 1000 (above 1000 it gives an error) so I'm fetching 1000 records at one time, then increase offset by 1000. But it's worth a try to just read it in pages with 50 rows. I'll try that. Thx