Commit 00e33676 authored by Didier Cadiou's avatar Didier Cadiou
Browse files

Readme update and improvments

parent 77c999d7
Loading
Loading
Loading
Loading
+22 −2
Original line number Diff line number Diff line
@@ -7,7 +7,11 @@ This project aims to give tools to extract data from Moodle cron's log files in

The supplied script, `import_into_DB.sh`, has been designed considering :
* sqlite3 is intalled on the server and executed calling `sqlite3` command (without speciying its path)
* Moodle cron log files are stored in a folder `/var/log/mmodle`
* Moodle cron log files are stored in a folder `/var/log/mmodle`, for example by having a line like this in the server crontab :

  ```
  php -f /path/to/moodle/root/folder/admin/cli/cron.php > /var/log/moodle/cron_$(date +\%H\%M).log 2>&1
  ```
* these files are named `cron_hhmm.log` (for example 'cron_1013.log' is the log file associated with the cron launched at 10h13)
* the shell command `ls -l $f | cut -d ' ' -f 6,7,8` is efficient to extract the file creation date

@@ -52,7 +56,23 @@ The resulting database own 4 tables
    * `name` = a name for this kind of error
    * `filtre` = a filtering string that could be used as is, inside a SQL query (with a `LIKE` operator), to get relevant lines

### Queries examples
### Usage

#### SQL clients

To explore results, a SQLite client should be used. Many open source software exist. Such as :

* Command line client, `sqlite3`, itself.  Examples of use :

  ```bash
  sqlite3 moodle-db.logs ".schema task" # to see task's columns
  sqlite3 moodle-db.logs "select count(*) from tasks;"
  ```
* https://sqlitebrowser.org/ a lightweight graphic client
* https://dbeaver.io/ a universal full featured client, able to connect to SQLite dabatase, but also to other types of databases such as mariadb, Oracle, and many others.


#### Queries examples

Below, some examples of what could be done with this database.