[solved] Add additional LOG File to the WEB GUI
-
-
Please try and report back the findings here
-
Hello and thank u for your participation...
I tried different ways but i can not get this to work
The guid from 2016 is a bit confusing for me.
My aim is to get an extra rsync log.
So i created a test.log with some dummy entries from the existing rsync log (so the syntax should be right...).
Then i created the 99mylogspecs.inc in /usr/share/openmediavault/engined/inc.
i just copy/paste the part from the existing rsync.inc and overwrite all rsync entries with "test".
PHP
Alles anzeigen<?php require_once("openmediavault/functions.inc"); \OMV\System\LogFileSpec::registerSpecification("test", [ "filename" => "test", "filepath" => "/var/log/test.log", "regex" => "/^(\S+\s+\S+) \[\d+\] (.*)$/", "columns" => [ "ts" => [ "index" => 1, "func" => function($v) { return strpdate($v,"Y/m/d G:i:s"); } ], "date" => [ "index" => 1, "func" => function($v) { return strftime("%c", strpdate($v,"Y/m/d G:i:s")); } ], "message" => 2 ]]);
I think, this should be right now...
No i need an javascript file MyLogFile.js
Again i orientated me on an existing file. So MyLogFile.js looks like this
Code
Alles anzeigenExt.define("OMV.module.admin.diagnostic.log.plugin.MyLogFile", { extend: "OMV.module.admin.diagnostic.log.plugin.Plugin", alias: "omv.plugin.diagnostic.log.MyLogFile", requires: [ "OMV.grid.column.WhiteSpace" ], id: "test", text: _("test"), stateful: true, stateId: "1cd077a2-7142-4fee-9fa2-5851ab25c4bf", columns: [{ text: _("Date & Time"), sortable: true, dataIndex: "rownum", stateId: "date", renderer: function(value, metaData, record) { return record.get("date"); } },{ xtype: "whitespacecolumn", text: _("Message"), sortable: true, dataIndex: "message", stateId: "message", flex: 1 }], rpcParams: { id: "test" }, rpcFields: [ { name: "rownum", type: "int" }, { name: "ts", type: "int" }, { name: "date", type: "string" }, { name: "message", type: "string" } ] });
i tried an unique UUIDv4 from here
I tried different ways, restart omv engine more than once... but nothing seem to work.
I can not get these test.log in my WEB GUI
Any help kindly appreciated !!
-
your signature lists OMV OMV 5.5.11-1 (which is outdated), please patch to latest 5.6.9-1 and confirm if issue still exists
-
Hello again.
Thank u for that: i just updated today in the morning, BEFORE testing all this. So i can confirm issue exists with 5.6.9-1 Usul as well.
Just updatet my signature too - thanks for the hint.
Maybe someone could try to get this working (additional log via WEB GUI) and can report back what i have to do?
:-/
Thank u
-
-
Hello (again).
I can not get this to work
I tried so many ways, but i need a serius step-by-step help.
I orienteted myself on the existing files - there is always "message" instead of "hostname".
Additional i think this is only the name of the column.
I did not understand the guid from 2016 as this is confusing.
Can someone please (PLEASE) try this and get this to work??!?!THANK U THAUSAND TIMES !!!
Is i told before, i want an extra rsync log, so i created a testlog file calles "MyLogFile.log" with some dummy entries in it
Code2021/06/11 13:00:10 [3002] >f+++++++++ BACKUP Test/Test/Test.txt 2021/06/11 13:01:10 [3002] >f+++++++++ BACKUP Test/Test/Test.xlsx 2021/06/11 13:01:59 [3002] cd+++++++++ BACKUP Test/BlaBla.doxc 2021/06/11 13:02:02 [3002] >f+++++++++ BACKUP Test/MoreTest/BlaBlaTest.exe 2021/06/11 13:02:11 [3002] Number of files: 301,270 (reg: 289,175, dir: 12,095) 2021/06/11 13:02:11 [3002] Number of created files: 446 (reg: 394, dir: 52) 2021/06/11 13:02:11 [3002] Number of regular files transferred: 394
My 99mylogspecs.inc now looks like this:
PHP
Alles anzeigen<?php require_once("openmediavault/functions.inc"); \OMV\System\LogFileSpec::registerSpecification("MyLogFile", [ "filename" => "MyLogFile", "filepath" => "/var/log/MyLogFile.log", "regex" => "/^(\S+\s+\S+) \[\d+\] (.*)$/", "columns" => [ "ts" => [ "index" => 1, "func" => function($v) { return strpdate($v,"Y/m/d G:i:s"); } ], "date" => [ "index" => 1, "func" => function($v) { return strftime("%c", strpdate($v,"Y/m/d G:i:s")); } ], "message" => 2 ]]);
and my MyLogFile.js looks like this
Code
Alles anzeigen// require("js/omv/grid/column/WhiteSpace.js") // require("js/omv/module/admin/diagnostic/log/plugin/Plugin.js") Ext.define("OMV.module.admin.diagnostic.log.plugin.MyLogFile", { extend: "OMV.module.admin.diagnostic.log.plugin.Plugin", alias: "omv.plugin.diagnostic.log.MyLogFile", requires: [ "OMV.grid.column.WhiteSpace" ], id: "MyLogFile", text: _("MyLogFile"), stateful: true, stateId: "331c2eea-fa7b-42d7-86a9-e644e641d6f6", columns: [{ text: _("Date & Time"), sortable: true, dataIndex: "rownum", stateId: "date", renderer: function(value, metaData, record) { return record.get("date"); } },{ xtype: "whitespacecolumn", text: _("Message"), sortable: true, dataIndex: "message", stateId: "message", flex: 1 }], rpcParams: { id: "MyLogFile" }, rpcFields: [ { name: "rownum", type: "int" }, { name: "ts", type: "int" }, { name: "date", type: "string" }, { name: "message", type: "string" } ] });
As told before: the UUIDv4 i claim from here
-
I orienteted myself on the existing files - there is always "message" instead of "hostname".
In general the code you provided looks good, but I didn't install & run it.
Another difference I spotted is the data format string, OMV uses
strpdate($v,"D M j H:i:s Y"); I'd try with that format first
OMV's ClamAV logging seems a good starting point
- Could you please elaborate on what existing file you modified?
- in which directory (full path) did you save 99mylogspecs.inc?
-
Hello (again ^^) and thank you for your participation.
Thank you for the link.
I already knew the provided Link - but together with the 2016 guide this seems more confusing... but yeah: i already take a look at it.So... thank you
1. Could you please elaborate on what existing file you modified?- for 99mylogsprecs.inc i orienteted myself on 90logfilespecs.inc in the same directory
in (my) existing 90logfilespecs.inc (on witch i orienteted myself) there is from line 293 to 313 the codeblock for the functional rsync log from the webgui. So i take this block and just copy/paste it to my 99mylogspecs.inc and changed all "rsync" to "MyLogFile". So i was sure, this shuld work now... as this is working with the normal rsync log, i did not change the formate of the date...
- for MyLogFile.js i orienteted myself on Rsync.js in the same directory
because i want to create a new rsync entry in the webgui, i think this would be the best choice...
in (my) existing Rsync.js i just changed "rsync" in line 29, 31, 36 and 57 to "MyLogFile" and the name in line 37 from "Rsync-Jobs" to "MyLogFile" Than copy/paste the whole codeblock in the new MyLogFile.js and saved it in
/var/www/openmediavault/js/omv/module/admin/diagnostic/log/plugin/MyLogFile.js
2. in which directory (full path) did you save 99mylogspecs.inc?
the directory as in the guid told:
/usr/share/openmediavault/engined/inc/99mylogspecs.inc
Than restart my NAS but nothing works - only the old logs are visible. No "MyLogFile"
so this way did not seem to work... -
I miss a comment regarding the different date format.
When you tried this and it stills fails, I'd suggest to open a new issue on OMV's github with the title
[GUIDE] Add custom log files to WebUI - not working
in "to Reproduce" attach the source code files as zip archive (so its easy to reproduce)
in "Reference to Forum" reference this post
-
Good Morning.
yeah u are right.
I tried with different date format now, but nothing changed.
So here is the issue on github
Thank u
-
Thanks, but don't see attachment with source code in issue
-
damn... my fault....
already edited the issuethx
-
Hello.
As already discussed in the GitHub issue,
my Testlog is now seen in the WebGUI
Me = Happy again
-
Kamikaze01
Hat den Titel des Themas von „Add additional LOG File to the WEB GUI“ zu „[solved] Add additional LOG File to the WEB GUI“ geändert. -
Hello.
As already discussed in the GitHub issue,
my Testlog is now seen in the WebGUI
Me = Happy again
Hi,
Can you please point me to the github discussion?
I'm trying to do the same (add additional log files to the GUI) but it still doesn't work at the moment.
Maybe I missed something...
Thx -
the link is in this threads post #11
-
Hi,
Thx for the link. Unfortunatly, I can't get this too work
Maybe someone could point my error. Here are the conf. files.root@home-server:~# ls -al /usr/share/openmediavault/engined/inc/*
-rw-r--r-- 1 root root 1155 May 14 15:41 /usr/share/openmediavault/engined/inc/10rootdevicefile.inc
-rw-r--r-- 1 root root 988 May 14 15:41 /usr/share/openmediavault/engined/inc/30datamodel.inc
-rw-r--r-- 1 root root 1538 May 14 15:41 /usr/share/openmediavault/engined/inc/60filesystembackend.inc
-rw-r--r-- 1 root root 1432 May 14 15:41 /usr/share/openmediavault/engined/inc/60networkinterfacebackend.inc
-rw-r--r-- 1 root root 1434 May 14 15:41 /usr/share/openmediavault/engined/inc/60storagedevicebackend.inc
-rw-r--r-- 1 root root 1393 May 14 15:41 /usr/share/openmediavault/engined/inc/90clamav.inc
-rw-r--r-- 1 root root 11631 May 14 15:41 /usr/share/openmediavault/engined/inc/90logfilespec.inc
-rw-r--r-- 1 root root 1383 Sep 2 16:34 /usr/share/openmediavault/engined/inc/90onedrive.inc
90onedrive.incPHP
Alles anzeigen<?php /** * This file is part of OpenMediaVault. * * @license http://www.gnu.org/licenses/gpl.html GPL Version 3 * @author Volker Theile <volker.theile@openmediavault.org> * @copyright Copyright (c) 2009-2021 Volker Theile * * OpenMediaVault is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * OpenMediaVault is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>. */ require_once("openmediavault/functions.inc"); \OMV\System\LogFileSpec::registerSpecification("onedrive", [ "filename" => "onedrive", "filepath" => "/var/log/onedrive/sbocquet.onedrive.log", "regex" => "/^(\S+\s+\S+)\s+(.*)$/", "columns" => [ "ts" => [ "index" => 1, "func" => function($v) { return strpdate($v,"Y-m-d H:i:s"); } ], "date" => [ "index" => 1, "func" => function($v) { return strftime("%c", strpdate($v,"Y-m-d H:i:s")); } ], "message" => 2 ]]);
root@home-server:~# ls -al /var/www/openmediavault/js/omv/module/admin/diagnostic/log/plugin/
total 68
drwxrwxr-x 2 openmediavault-webgui openmediavault-webgui 4096 Sep 2 16:57 .
drwxrwxr-x 3 openmediavault-webgui openmediavault-webgui 4096 Jul 30 09:22 ..
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2482 Jul 4 18:55 Apt.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2163 Jul 4 18:55 Auth.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 1974 Jul 4 18:55 Boot.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 1998 Jun 13 13:06 ClamAV.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2167 Jul 4 18:55 Daemon.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 6380 Jul 4 18:55 Ftp.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2181 Jul 4 18:55 Messages.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2009 Sep 2 16:47 Onedrive.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2227 Jul 4 18:55 Plugin.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2027 Jul 4 18:55 Rsyncd.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 1995 Jul 4 18:55 Rsync.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2023 Jul 4 18:55 Smart.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 3725 Jul 4 18:55 Smb.js
-rw-rw-r-- 1 openmediavault-webgui openmediavault-webgui 2167 Jul 4 18:55 Syslog.js
Code
Alles anzeigen/** * This file is part of OpenMediaVault. * * @license http://www.gnu.org/licenses/gpl.html GPL Version 3 * @author Volker Theile <volker.theile@openmediavault.org> * @copyright Copyright (c) 2009-2021 Volker Theile * * OpenMediaVault is free software: you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by * the Free Software Foundation, either version 3 of the License, or * any later version. * * OpenMediaVault is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * * You should have received a copy of the GNU General Public License * along with OpenMediaVault. If not, see <http://www.gnu.org/licenses/>. */ // require("js/omv/grid/column/WhiteSpace.js") // require("js/omv/module/admin/diagnostic/log/plugin/Plugin.js") /** * @class OMV.module.admin.diagnostic.log.plugin.Onedrive * @derived OMV.module.admin.diagnostic.log.plugin.Plugin * Class that implements the 'Onedrive' logfile diagnostics plugin. */ Ext.define("OMV.module.admin.diagnostic.log.plugin.Onedrive", { extend: "OMV.module.admin.diagnostic.log.plugin.Plugin", alias: "omv.plugin.diagnostic.log.onedrive", requires: [ "OMV.grid.column.WhiteSpace" ], id: "onedrive", text: _("Onedrive"), stateful: true, stateId: "cfdba1ee-46d8-43fc-971c-5c846805c4a9", columns: [{ text: _("Date & Time"), sortable: true, dataIndex: "rownum", stateId: "date", renderer: function(value, metaData, record) { return record.get("date"); } },{ xtype: "whitespacecolumn", text: _("Message"), sortable: true, dataIndex: "message", stateId: "message", flex: 1 }], rpcParams: { id: "onedrive" }, rpcFields: [ { name: "rownum", type: "int" }, { name: "ts", type: "int" }, { name: "date", type: "string" }, { name: "message", type: "string" } ] });
I think that the parsing of the log file is maybe the error because of the milliseconds, but it should create the entry in the WebUI even if the parse doesn't work, no ?Here is the log file
Code2021-Sep-07 09:38:16.6625359 Configuring Global Azure AD Endpoints 2021-Sep-07 09:38:17.3047206 Initializing the Synchronization Engine ... 2021-Sep-07 09:38:17.3047814 Initializing monitor ... 2021-Sep-07 09:38:17.3048137 OneDrive monitor interval (seconds): 120 2021-Sep-07 09:38:18.828254 Trying to delete item Images/Pellicule/IMG_20210819_172831.jpg 2021-Sep-07 09:38:18.8292999 Trying to delete item Images/Pellicule/IMG_20210820_103229.jpg 2021-Sep-07 09:38:18.8301002 Trying to delete item Images/Pellicule/IMG_20210819_172918.jpg 2021-Sep-07 09:38:18.8308931 Trying to delete item Images/Pellicule/IMG_20210828_192632.jpg 2021-Sep-07 09:38:18.8317183 Trying to delete item Documents/Professionnels/CV Stéphane BOCQUET - CPSI.pdf 2021-Sep-07 09:38:18.8325246 Trying to delete item Images/Pellicule/Screenshot_20210830-140425_65dd53f706ee14f7c817b7f96db127ea.jpg
Any Idea or Help is appreciated.
Thanks -
Hi,
Just a little update as I still don't understand what is missing or wrong in my config files.
If someone can help, thanks. -
Hi,
I've just rebooted my server and... the entry is here (see attachment) !
Still have some problems to parse the date of the log file. I use
strpdate($v,"Y-m-d H:i:s")
and the log format is :Code2021-Nov-29 10:36:27.3431674 Starting a sync with OneDrive 2021-Nov-29 10:36:27.343256 Syncing changes from OneDrive ... 2021-Nov-29 10:36:30.0845614 Sync with OneDrive is complete
Maybe the milliseconds ? How can I solve this ?
Thx -
The correct parse format seems to be "Y-m-d H:i:s.u", but unfortunately, it still doesn't work
Did you restart the server to reload the corrected PHP or JavaScript code?
Jetzt mitmachen!
Sie haben noch kein Benutzerkonto auf unserer Seite? Registrieren Sie sich kostenlos und nehmen Sie an unserer Community teil!