Coding Thread, Papercut Print Logger Free edition - Log Distiller ASP page in Coding and Web Development; Given the limited budgets in schools it can be difficult to get funds for certain things like print logging. Thankfully ...
Papercut Print Logger Free edition - Log Distiller ASP page
Given the limited budgets in schools it can be difficult to get funds for certain things like print logging. Thankfully the people at PaperCut have for a while had a free version of their print logging software that can be aquired here:
This is quite useful to gather data but requires a lot of manual labour to convert this raw data into usable 'evidence' to justify the full product in order to keep a check on paper mad teachers and students. To make this process more easy I created a small and very rough ASP page which will take the raw monthly CSV logs and convert them into a table showing how much each user has printed to each printer for a time period that you specify.
It is a simple ASP page and just needs to be put in an IIS site on the server which houses the Papercut software. It is controlled by editing four simple constants at the top of the ASP file.
Code:
Const SiteFolder = "C:\Inetpub\Admin" 'Folder where the summary csv file is stored
Const PrintLogsFolder = "c:\Program Files\PaperCut Print Logger\logs\csv\monthly" 'Folder where the papercut print logger csv files are stored
Const SummaryCSVName = "dest.csv" 'name of the CSV file that will hold the concatinated logs
Const MaxSummaryCsvAge = 30 'The maximum age in minutes of the Summary file before it is recreated
Each time the page is run it will check to see if the summary is older than the timeout in minutes and if it is it will recreate it with the updated logs from the PaperCut folder.
When you first load the page it will create a list will all of the avalible log data and the earliest and latest dates will be shown in the filter boxes at the top. To limit the summary to the dates that you want simply enter the dates that you want into the filter boxes and click filter.
This code is rough but has been very helpful in proving a point to some of the staff and hopefully it can help others. It works best in Internet Explorer as that is the only one that allows for the rotation of the printer names to save width on the top row. CSS has been used so that it looks alright and is easy to change the appearance of it.
Nice, I've been using pivottables/charts in Excel to get pretty output from this. Not an ASP coder myself so don't know how tricky it would be, but if you do do any more work on it, sorting by total pages instead of username would be brilliant!
I can't get this to work. I've put the script in the wwwroot folder, under the default website in IIS, but I keep getting a forbidden error. I've checked permissions on the folder and they appear to be the same as another site which works.
I can't get this to work. I've put the script in the wwwroot folder, under the default website in IIS, but I keep getting a forbidden error. I've checked permissions on the folder and they appear to be the same as another site which works.
Have you created the 'admin' folder for the output to go into?
I can't get this to work. I've put the script in the wwwroot folder, under the default website in IIS, but I keep getting a forbidden error. I've checked permissions on the folder and they appear to be the same as another site which works.
What error are you getting specificly, if you have your dest.csv in the wwwroot folder you will need to give whatever user is running the ASP (annonomys hosting account) will need read+write access to that folder as it creates the file at runtime. I ususlly use this on the managment page of my networks which are secured by windows integrated security meaning that the script runs under the context of an admin account that has write access.
You will also need execute permissions on the sites IIS properties. If you want it running for general consumption by annonomys users then I recommend pointing the SiteFolder constant to a seporate folder which has read+write access for the annonomys IIS account in order to make it run smoothly and without opening up any security holes.
@OutToLunch - I had a look at enabling this sorting but unfourtunatly the CSV database reader that I am using doesn't seem to be able to accomplish this along with the pivot. I may develop this further in future but it would require a more substantial back end and some nasty merging logic to put it all into an access DB for finer grained control of the data.
In the wwwroot folder I have a folder called PrinterUsage and at present 'Everyone' has read/write access to this folder. I take it I should remove that and make it so that only the IUSR has read/write access to this folder? I then need to create a seperate folder within PrinterUsage where IUSR has read/write permissions.
If I wanted the script only to be usable by a particular usergroup then how would I go about that? Set the permissions for that group instead of the IUSR account?
Sorry if this is a daft question. Never really got my head around IIS.
Now just to work out how only certain usergroups can access this script.
Glad to hear that you go it working. As for security you could set the directory security on the PrintUsage folder to Integrated windows auth and not annonomys. Then in the NTFS permissions for the folder and files set full access for the group that you want to have access to it and remove permissions for anyone else. This way it should use windows integrated authentication, if the user that tries to get to it is not allowed they will be prompted for a username and password.
Glad to hear that you go it working. As for security you could set the directory security on the PrintUsage folder to Integrated windows auth and not annonomys. Then in the NTFS permissions for the folder and files set full access for the group that you want to have access to it and remove permissions for anyone else. This way it should use windows integrated authentication, if the user that tries to get to it is not allowed they will be prompted for a username and password.
Thanks. I'll give that a whirl tomorrow. Useful script.
How difficult would it be to add a totals row to show the total pages printed from each printer for the filter period?
Added, summaries per printer per paper type and also papertype per teacher.
I have updated the codeing as best as I could while still retaining the lightweicht CSV database driver. I have tweaked the layout a bit to make it look better and have also added in some error handling in case you end up without any data for the period you selected. It can now also do a report on a single day as it now takes the end time as 23:59 rather that 0:00 as it was doing before. Still have not able to add the sorting feature due to the driver but I am still looking into it.
The screenshot and new downloads can be found in the first post here: EDIT Or not I can't seem to edit it, Grr, will add to this post instead and hopefully a mod or admin can give me permission to change my own post some time later.
EDIT2: Uploaded
Last edited by SYNACK; 30th January 2009 at 07:52 PM.
By popular request I have created a simple installation guide to help people get it up and running. There are many other ways to set it up so that it fits into your system but this method should not require you to change any variables in the site. This document assumes that PaperCut and IIS are both installed also that PaperCut has been installed to the default location. It also assumes that you have administrator privilages on the account you will be using to view the page.
Last edited by SYNACK; 2nd February 2009 at 09:53 PM.