Extracting the Log to a text file

Started by thetechfirm

Extracting the Log to a text file   12 May 2018, 21:46

Is there an easy way to extract the log to a text file?
I read about the database file, but working with that sounds a bit daunting. We have a monitoring page and it would be helpful if i could post the log file to see who exceeded their quota, system errors, etc..
SoftPerfect Support forum - Andrew avatar image

Re: Extracting the Log to a text file   12 May 2018, 23:55

There isn't really anything difficult in working with the database and you can extract data from it with simple SQL statements.

For example, to convert the list of events to a text file, try the following:
  1. Download the SQLite command line shell and extract sqlite3.exe.
  2. In a command prompt execute something like this:
      sqlite3 -csv "C:\ProgramData\SoftPerfect\Bandwidth Manager\Bandwidth Manager.DB" "SELECT * FROM EVENT ORDER BY ID" > somefile.txt  
This will open the database file, select all events from the EVENT table and save them to somefile.txt comma-separated.

Another way to do it is to connect to the database directly from your web-page (depending on what scripting language is available) without using an intermediate text file. You can use the SQLiteSpy tool to explore the database.

Re: Extracting the Log to a text file   13 May 2018, 11:03

Wow. Looks like what I was looking for. I will give it try and let you know how I made out.
Thanks

Re: Extracting the Log to a text file   14 May 2018, 21:30

You were 100% correct, it wasn't that bad and i was able to get the logs very easily.
Thanks again!
SoftPerfect Support forum - Ann avatar image
Ann

Re: Extracting the Log to a text file   15 May 2018, 09:53

Glad to hear that everything went well and you are happy with the result smile

Re: Extracting the Log to a text file   15 May 2018, 11:05

Can I use SQLite to clear the log? The client was asking if we could clear the logs weekly.
SoftPerfect Support forum - Andrew avatar image

Re: Extracting the Log to a text file   15 May 2018, 11:28

Absolutely, just run it like this to clear the log:
sqlite3 "C:\ProgramData\SoftPerfect\Bandwidth Manager\Bandwidth Manager.DB" "DELETE FROM EVENT"

Alternatively, if you only want to remove log records older than a week:
sqlite3 "C:\ProgramData\SoftPerfect\Bandwidth Manager\Bandwidth Manager.DB" "DELETE FROM EVENT WHERE MESSAGE_TIME < datetime('now', '-7 days', 'localtime')"

Sometimes you can find a solution faster if you try the forum search, have a look at the knowledge base, or check the software user manual to see if your question has already been answered.

Our forum rules are simple:

  • Be polite.
  • Do not spam.
  • Write in English. If possible, check your spelling and grammar.

Author:

Subject

A brief and informative title for your message, approximately 4–8 words:

     

Spam prevention: please enter the following code in the input field below.

 **     **  **     **  ********  ********         ** 
 **     **  **     **     **     **     **        ** 
 **     **  **     **     **     **     **        ** 
 *********  *********     **     ********         ** 
 **     **  **     **     **     **         **    ** 
 **     **  **     **     **     **         **    ** 
 **     **  **     **     **     **          ******  

Message: