Category:Cumulus MX: Difference between revisions

1,205 bytes added ,  10:06, 30 June 2020
m
Line 101: Line 101:
=== ExportMySQL.exe ===
=== ExportMySQL.exe ===


This is second exe file in the package. It will read log files and insert rows into an existing database table. Since it only does inserts, despite the name of this function, it is not just for MySQL tables, it should work with whatever database type you have.  
This second exe file has been available since the original MX package as Steve Loft developed this in April 2015, but sadly few people even notice it exists, and if they do, it is unlikely they know how to use it. Hopefully, some people will read this section and find out!


The executable has a mandatory single parameter that tells it which log files to read.
Obviously it was updated when Mark Crossley added the Feels Like fields to log files.
 
Put simply, this executable will read log files and insert (insert ignore) rows into an existing database table. Since it only does inserts, despite the name of this function, it is not just for MySQL tables, the included SQL should work with whatever database table type you have.
 
The executable has a mandatory single parameter that tells it which log files to read, there are only 3 possible parameters ("dayfile", "monthly", or path to a file). It needs to know what locale (or culture settings) it is to use to work out what character separates each item in the log file list. It also needs to read your Cumulus.ini file, as it takes these "input parameters" from MySQL section in that:
*Host
*Port
*User
*Pass
*Database
*MonthlyTable
*DayfileTable


==== Daily summary log file ====
==== Daily summary log file ====
Line 130: Line 141:
# Now scroll down to '''Create database table (save settings first)'''
# Now scroll down to '''Create database table (save settings first)'''
#* Here click '''Create Monthly'''
#* Here click '''Create Monthly'''
# Now you have a database table ready, you can use the executable to read all lines in every standard log file it can find in your data folder (it looks for files with the right pattern of date and text in the folder).
# Now you have a database table ready, you can use the executable to read all lines in either one (if path to that file is in parameter), or every (if parameter is monthly) standard log file.
#*If the parameter is "monthly" it will look in folder '''data'''  for every file it can find with a file name of datestring + "log.txt" where datestring is a 3 letter code (in your locale) for each month (1 to 12) followed by a 2 digit year (from "00" to "99") so that is how it finds every standard log file in the folder.
# Open a terminal display (if you are using Windows then, open a Command Window, a Windows Powershell window, or a Windows Terminal window)
# Open a terminal display (if you are using Windows then, open a Command Window, a Windows Powershell window, or a Windows Terminal window)
# Run this executable in that terminal display (or command window) by using  '''sudo mono ExportMySql.exemonthly''' or <tt>ExportMySql.exe daily</tt> depending on device.
# Run this executable in that terminal display (or command window) by using  '''sudo mono ExportMySql.exe monthly''' or <tt>ExportMySql.exe monthly</tt> depending on device.
#* Alternatively, replace '''monthly''' parameter by a full path to a single standard log file, and it will process just that log file.
# In the terminal display (or command window) you will see '''Parameter = monthly''' confirming what you entered and in the line below that a rapidly updating code that is the primary key (omitting the first two digits of the year) displayed for each row it tries to insert into the table.  If that primary key already exists in the table, it will still show the key, but no insert will take place.  So you can run this again to pick up any additions to the latest log file since the original run.
# In the terminal display (or command window) you will see '''Parameter = monthly''' confirming what you entered and in the line below that a rapidly updating code that is the primary key (omitting the first two digits of the year) displayed for each row it tries to insert into the table.  If that primary key already exists in the table, it will still show the key, but no insert will take place.  So you can run this again to pick up any additions to the latest log file since the original run.
#If you want MX to continue adding new rows to this database table, still in the admin interface, still in MySQL settings page:
#If you want MX to continue adding new rows to this database table, still in the admin interface, still in MySQL settings page:
5,838

edits