Navigation

    Logo
    • Register
    • Login
    • Search
    • Recent
    • Tags
    • Unread
    • Categories
    • Unreplied
    • Popular
    • GitHub
    • Docu
    • Hilfe
    1. Home
    2. Deutsch
    3. ioBroker Allgemein
    4. [Log Parser Adapter] Fragen zu Regex und Filterregeln

    NEWS

    • Neuer Blog: Fotos und Eindrücke aus Solingen

    • ioBroker@Smart Living Forum Solingen, 14.06. - Agenda added

    • ioBroker goes Matter ... Matter Adapter in Stable

    [Log Parser Adapter] Fragen zu Regex und Filterregeln

    This topic has been deleted. Only users with topic management privileges can see it.
    • Negalein
      Negalein Global Moderator @Mic last edited by

      @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

      Frage von @Negalein.

      Hi Mic!

      Gute Idee mit dem Auslagern der Fragen! 🙂

      Also, es funktioniert nicht.

      So siehts bei mir aktuell aus.

            {
              "active": true,
              "name": "Laura-Volume",
              "whitelistAnd": "-+-",
              "whitelistOr": "",
              "blacklist": "/##\\{\\s?\\\".*\\\"\\s?\\}##/",
              "debug": false,
              "info": true,
              "warn": false,
              "error": false,
              "clean": "/script.js.[^:]*: /, -+-",
              "maxLength": "",
              "merge": false,
              "dateformat": "#DD.MM.# hh:mm"
            },
            {
              "active": true,
              "name": "Alexa",
              "whitelistAnd": "*",
              "whitelistOr": "[Alexa-Log-Script], Alexa_Laura_Volume",
              "blacklist": "",
              "debug": false,
              "info": true,
              "warn": false,
              "error": false,
              "clean": "-+-, /script\\.js\\.[^:]*: \[Alexa-Log-Script\]/",
              "maxLength": "",
              "merge": false,
              "dateformat": "#DD.MM.# hh:mm"
            },
      

      In "Laura-Volume" wurde Kalender geschrieben. In "Alexa" nicht.

      log.gif

      1 Reply Last reply Reply Quote 0
      • Mic
        Mic Developer last edited by Mic

        @Negalein sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

        [Alexa-Log-Script], Alexa_Laura_Volume

        Ich kann es nicht reproduzieren, bei mir geht das wunderbar.
        Mach mal bitte folgendes:

        1. Setze im Adapter bei Alexa-Filter: "Whitelist ODER": [Alexa-Log-Script], Alexa_Test_1 (Rest so lassen)

        2. Erstelle mal ein neues JavaScript im JS-Adapter, Name Alexa_Test_1

        3. In diesem Script führst du aus: log('-+-Laura Volume 30 07:32 Uhr-+-');

        Negalein 1 Reply Last reply Reply Quote 0
        • Negalein
          Negalein Global Moderator @Mic last edited by

          @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

          Mach mal bitte folgendes:

          Sehr komisch das ganze!

          in 1.) funktioniert es, in 2.) nicht.
          Da wird dann aber durch 2.) auch nichts von [Alexa-Log-Script] reingeschrieben.
          instances - ioBroker (7).png
          log.gif

          Mic 1 Reply Last reply Reply Quote 0
          • Mic
            Mic Developer @Negalein last edited by

            @Negalein
            Ich kann es leider nicht reproduzieren, da es bei mir geht.

            • Aktuelle Adapter-Version nutzt du? War bis vor 30 Minuten noch die Version 0.4.5 (jetzt mit der 0.4.6 hat sich da aber nichts geändert)
            • node.js Version auch keine alte vermutlich, oder?
            • Du hast mit log('-+-Laura Volume 30 07:32 Uhr-+-'); getestet, richtig? Das JavaScript heißt "Alexa_Test_1"?
            Negalein 1 Reply Last reply Reply Quote 0
            • Negalein
              Negalein Global Moderator @Mic last edited by

              @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

              Ich kann es leider nicht reproduzieren, da es bei mir geht.

              Ich verstehs auch nicht.

              Aktuelle Adapter-Version nutzt du? War bis vor 30 Minuten noch die Version 0.4.5 (jetzt mit der 0.4.6 hat sich da aber nichts geändert)

              Ja, vor einer halben Stunde upgedatet.

              node.js Version auch keine alte vermutlich, oder?

              Nö
              Node.js: 10.17.0 NPM: 6.11.3

              Du hast mit log('-+-Laura Volume 30 07:32 Uhr-+-'); getestet, richtig? Das JavaScript heißt "Alexa_Test_1"?

              Richtig

              Das komische ist, mach ich es getrennt, funktioniert es.

                    {
                      "active": true,
                      "name": "Laura-Volume",
                      "whitelistAnd": "-+-",
                      "whitelistOr": "",
                      "blacklist": "/##\\{\\s?\\\".*\\\"\\s?\\}##/",
                      "debug": false,
                      "info": true,
                      "warn": false,
                      "error": false,
                      "clean": "/script.js.[^:]*: /, -+-",
                      "maxLength": "",
                      "merge": false,
                      "dateformat": "#DD.MM.# hh:mm"
                    },
                    {
                      "active": true,
                      "name": "Alexa",
                      "whitelistAnd": "[Alexa-Log-Script]",
                      "whitelistOr": "",
                      "blacklist": "",
                      "debug": false,
                      "info": true,
                      "warn": false,
                      "error": false,
                      "clean": "/script\.js\.[^:]*: [Alexa-Log-Script]/",
                      "maxLength": "",
                      "merge": false,
                      "dateformat": "#DD.MM.# hh:mm"
                    },
              

              Mach ich beides in einem funktioniert [Alexa-Log-Script] auch nicht.

                    {
                      "active": false,
                      "name": "Alexa",
                      "whitelistAnd": "*",
                      "whitelistOr": "[Alexa-Log-Script], Alexa_Test_1",
                      "blacklist": "",
                      "debug": false,
                      "info": true,
                      "warn": false,
                      "error": false,
                      "clean": "-+-, /script\.js\.[^:]*: [Alexa-Log-Script]/",
                      "maxLength": "",
                      "merge": false,
                      "dateformat": "#DD.MM.# hh:mm"
                    }
              
              Mic 1 Reply Last reply Reply Quote 0
              • Mic
                Mic Developer @Negalein last edited by

                @Negalein
                Gibts ja nicht...
                Noch ein Versuch:
                Ersetze mal unter "Whitelist ODER" [Alexa-Log-Script], Alexa_Test_1 durch [Alexa-Log-Script], -+-

                Negalein 1 Reply Last reply Reply Quote 0
                • Negalein
                  Negalein Global Moderator @Mic last edited by

                  @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                  Noch ein Versuch:

                  Fehlerbild bleibt

                  Es wird nichts von [Alexa-Log-Script] und auch nichts von -+- angezeigt.

                  Mic 1 Reply Last reply Reply Quote 0
                  • Mic
                    Mic Developer @Negalein last edited by Mic

                    @Negalein
                    Verstehe ich nicht.
                    Ich setze z.B. folgenden Filter:
                    f1.png

                    Dann setze ich folgendes in einem beliebigen JavaScript ab:

                    log('TEST A: [Alexa-Log-Script] Test');
                    log('TEST B: -+- Test');
                    

                    Dann kommt alles schön an (Datenpunkt logparser.0.filters.Test.json)

                    [
                    	{
                    		"date": "Heute 14:40",
                    		"severity": "<span class='logInfo'>info</span>",
                    		"from": "javascript.0",
                    		"message": "script.js.Test_1: TEST B: -+- Test",
                    		"ts": 1586781652664
                    	},
                    	{
                    		"date": "Heute 14:40",
                    		"severity": "<span class='logInfo'>info</span>",
                    		"from": "javascript.0",
                    		"message": "script.js.Test_1: TEST A: [Alexa-Log-Script] Test",
                    		"ts": 1586781652664
                    	}
                    ]
                    
                    Negalein 1 Reply Last reply Reply Quote 0
                    • Negalein
                      Negalein Global Moderator @Mic last edited by Negalein

                      @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                      Verstehe ich nicht.

                      Ich hab jetzt mal komplett neu erstellt.
                      instances - ioBroker (9).png
                      Da funktioniert es. Nur der Regex in Bereinigen will nicht ganz.
                      -+-, /script\.js\.[^:]*: [Alexa-Log-Script]/
                      vis (21).png

                      Mic 1 Reply Last reply Reply Quote 0
                      • Mic
                        Mic Developer @Negalein last edited by

                        @Negalein sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                        Da funktioniert es.

                        Ok, super.

                        Nur der Regex in Bereinigen will nicht ganz.

                        Trag da mal ein: /script\.js\.[^:]*: /, [Alexa-Log-Script], -+-

                        Negalein 1 Reply Last reply Reply Quote 0
                        • Negalein
                          Negalein Global Moderator @Mic last edited by

                          @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                          Ok, super.
                          Trag da mal ein: /script.js.[^:]*: /, [Alexa-Log-Script], -+-

                          Perfekt, es läuft!
                          War eine schwere Geburt! 😉
                          Hast du eine Kaffeekassa?

                          vis (22).png

                          Mic 1 Reply Last reply Reply Quote 0
                          • Mic
                            Mic Developer @Negalein last edited by

                            @Negalein sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                            Perfekt, es läuft!
                            War eine schwere Geburt! 😉
                            Hast du eine Kaffeekassa?

                            Das war's wirklich 🙂
                            Danke, noch nicht, sollte ich vielleicht mal bei Gelegenheit einrichten...
                            Aber ich helfe gerne und danke dir fürs Testen, will den Adapter möglichst bald ins Latest bekommen, und da brauche ich euer Feedback...

                            @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                            /script\.js\.[^:]*: /

                            Das wäre evtl. auch was als globale Option im Adapter, also dass bei JavaScript-Logs grundsätzlich optional der ganze erste Teil script.js.Script-Pfad.Script-Name: rausgeschnitten wird.

                            Negalein Glasfaser 2 Replies Last reply Reply Quote 1
                            • Negalein
                              Negalein Global Moderator @Mic last edited by

                              @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                              Danke, noch nicht, sollte ich vielleicht mal bei Gelegenheit einrichten...

                              schick mir per Chat mal deine Paypal 🙂

                              Aber ich helfe gerne und danke dir fürs Testen

                              Jetzt teste ich noch, dass ich die 2 derzeit deaktivierten "Alexa" und "Laura-Volume" im Adapter lösche, die beiden DP lösche und dann wieder im Adapter "Test" zu "Alexa" umbenenne.

                              1 Reply Last reply Reply Quote 0
                              • Glasfaser
                                Glasfaser @Mic last edited by Glasfaser

                                @Mic sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                                Das wäre evtl. auch was als globale Option im Adapter,

                                Dann ist das Filterfeld ( Bereinigen ) auch nicht so vollgepackt 👍

                                ... bei dem Platzbedarf im Feld Bereinigen 😎

                                1 Reply Last reply Reply Quote 0
                                • Iccube
                                  Iccube last edited by

                                  Hallo,
                                  habe mal ne frage zu den Filterregeln Globale Blacklist verstehe das noch nicht so ganz.
                                  Habe das in Globale Blacklist eingetragen :

                                  /instance system\.adapter\.[^\s]*  Terminated (NO_ERROR): Without reason/
                                  

                                  Wird aber Trozdem unter Info angezeigt
                                  log pareser.png
                                  log pareser_1.png

                                  Mic 1 Reply Last reply Reply Quote 0
                                  • Mic
                                    Mic Developer @Iccube last edited by

                                    @Iccube
                                    Gehe mal im ioBroker Admin links auf "Log", dann oben "LOG HERUNTERLADEN" und da dann die entsprechende Logzeile komplett kopieren und hier in Code-Tags einfügen.

                                    Iccube BBTown 2 Replies Last reply Reply Quote 0
                                    • Iccube
                                      Iccube @Mic last edited by

                                      @Mic

                                      2020-04-27 19:20:00.021 - info: host.iobroker instance system.adapter.dwd.0 started with pid 4722
                                      2020-04-27 19:20:00.623 - info: dwd.0 (4722) starting. Version 2.4.7 in /opt/iobroker/node_modules/iobroker.dwd, node: v12.16.2, js-controller: 3.0.19
                                      2020-04-27 19:20:01.376 - info: dwd.0 (4722) Terminated (NO_ERROR): Without reason
                                      2020-04-27 19:20:01.880 - info: host.iobroker instance system.adapter.dwd.0 terminated with code 0 (NO_ERROR)
                                      
                                      Mic 1 Reply Last reply Reply Quote 0
                                      • BBTown
                                        BBTown @Mic last edited by

                                        @Mic

                                        Hast Du eine Idee für mich weshalb die Angaben von alexa2.0.History.json nicht in logparser.0.filters.Alexa.json landen?
                                        c64c8188-8eca-4d19-a3df-dff05fed42cb-grafik.png

                                        ede76d40-bc16-424f-8ff9-274274561e38-grafik.png

                                        /******************************************************************************************************
                                        * JavaScript Adapter Script for Log-Parser-Adapter: https://github.com/Mic-M/ioBroker.logparser
                                        * --------------------------------------------------------------
                                        * Purpose: Get the history of all spoken Alexa commands into the log
                                        *          Required: Alexa adapter - https://github.com/Apollon77/ioBroker.alexa2
                                        * Source:  https://github.com/Mic-M/ioBroker.logparser
                                        * Autor:   Mic-M (Github) | Mic (ioBroker)
                                        * --------------------------------------------------------------------------------------
                                        * Change Log:
                                        *  1.0.0  Mic-M   * Adoption to Log Parser Adapter
                                        *  0.1.0  Mic-M   * Initial release (for Log Script - https://github.com/Mic-M/iobroker.logfile-script).
                                        ******************************************************************************************************/
                                        
                                        /******************************************************************************************************
                                        * Script Settings
                                        ******************************************************************************************************/
                                        
                                        // **Capitalize First Letters**
                                        // The spoken command to Alexa is being returned in lowercase, like "turn on kitchen light". 
                                        // With this option set to true, the output will be "Turn On Kitchen Light" (so capitalized first letter of each word)
                                        const g_capFirstLetters = true;
                                        
                                        
                                        /******************************************************************************************************
                                        * End of Script Settings. Please do not change anything below here.
                                        ******************************************************************************************************/
                                        
                                        main();
                                        function main() {
                                           // All Alexa adapter instances, so alexa2.0.History.json, alexa2.1.History.json, alexa2.2.History.json, etc.
                                           on({id: /^alexa2\.\d\.History\.json$/, change:'any'}, function(obj) {
                                        
                                               // obj.state.val: JSON string of object.
                                               // Like: {"name":"Alexa Flur","serialNumber":"xxxxxxxxxx","summary":"Wohnlicht an","creationTime":1582843794820, ... }
                                               let objHistory = JSON.parse(obj.state.val); 
                                        
                                               // ignore alexa keywords or empty value.
                                               if(! (['', 'alexa','echo','computer'].includes(objHistory['summary']) )) {
                                                   // ignore "sprich mir nach"
                                                   if (!(objHistory['summary'].includes('sprich mir nach '))) {
                                                       log('[Alexa-Log-Script] ##{"message":"' + formatAlexaSummary(objHistory['summary']) + '", "from":"' + objHistory['name'] + '"}##');
                                                   }
                                               }
                                           });
                                        }
                                        
                                        /**
                                        * Formats the Alexa summary text accordingly.
                                        * @param {string} summaryText   The summary text
                                        * @return {string} the formatted summary
                                        */
                                        function formatAlexaSummary(summaryText) {
                                           if (g_capFirstLetters) summaryText = summaryText.replace(/(^|\s)\S/g, l => l.toUpperCase()); // Capitalize if set. https://stackoverflow.com/questions/2332811/
                                           return summaryText;
                                        }
                                        


                                        8d5bc591-942f-4ecd-8d6f-613fa684b2db-grafik.png

                                        Mic 1 Reply Last reply Reply Quote 0
                                        • Mic
                                          Mic Developer @Iccube last edited by

                                          @Iccube
                                          /instance system\.adapter\.[^\s]* Terminated (NO_ERROR): Without reason/ würde eine Logzeile wie diese hier erwarten:

                                          host.ctioBroker instance system.adapter.dwd.0 Terminated (NO_ERROR): Without reason
                                          

                                          Bei dir ist die Logausgabe aber anders.
                                          Mache einfach mal das hier in der Global Blacklist: Terminated (NO_ERROR): Without reason
                                          Das brauchst du wohl bei anderen Adaptern auch nicht, daher generisch.

                                          Iccube 1 Reply Last reply Reply Quote 0
                                          • Mic
                                            Mic Developer @BBTown last edited by

                                            @BBTown sagte in [Log Parser Adapter] Fragen zu Regex und Filterregeln:

                                            @Mic

                                            Hast Du eine Idee für mich weshalb die Angaben von alexa2.0.History.json nicht in logparser.0.filters.Alexa.json landen?
                                            c64c8188-8eca-4d19-a3df-dff05fed42cb-grafik.png

                                            ede76d40-bc16-424f-8ff9-274274561e38-grafik.png

                                            /******************************************************************************************************
                                            * JavaScript Adapter Script for Log-Parser-Adapter: https://github.com/Mic-M/ioBroker.logparser
                                            * --------------------------------------------------------------
                                            * Purpose: Get the history of all spoken Alexa commands into the log
                                            *          Required: Alexa adapter - https://github.com/Apollon77/ioBroker.alexa2
                                            * Source:  https://github.com/Mic-M/ioBroker.logparser
                                            * Autor:   Mic-M (Github) | Mic (ioBroker)
                                            * --------------------------------------------------------------------------------------
                                            * Change Log:
                                            *  1.0.0  Mic-M   * Adoption to Log Parser Adapter
                                            *  0.1.0  Mic-M   * Initial release (for Log Script - https://github.com/Mic-M/iobroker.logfile-script).
                                            ******************************************************************************************************/
                                            
                                            /******************************************************************************************************
                                            * Script Settings
                                            ******************************************************************************************************/
                                            
                                            // **Capitalize First Letters**
                                            // The spoken command to Alexa is being returned in lowercase, like "turn on kitchen light". 
                                            // With this option set to true, the output will be "Turn On Kitchen Light" (so capitalized first letter of each word)
                                            const g_capFirstLetters = true;
                                            
                                            
                                            /******************************************************************************************************
                                            * End of Script Settings. Please do not change anything below here.
                                            ******************************************************************************************************/
                                            
                                            main();
                                            function main() {
                                               // All Alexa adapter instances, so alexa2.0.History.json, alexa2.1.History.json, alexa2.2.History.json, etc.
                                               on({id: /^alexa2\.\d\.History\.json$/, change:'any'}, function(obj) {
                                            
                                                   // obj.state.val: JSON string of object.
                                                   // Like: {"name":"Alexa Flur","serialNumber":"xxxxxxxxxx","summary":"Wohnlicht an","creationTime":1582843794820, ... }
                                                   let objHistory = JSON.parse(obj.state.val); 
                                            
                                                   // ignore alexa keywords or empty value.
                                                   if(! (['', 'alexa','echo','computer'].includes(objHistory['summary']) )) {
                                                       // ignore "sprich mir nach"
                                                       if (!(objHistory['summary'].includes('sprich mir nach '))) {
                                                           log('[Alexa-Log-Script] ##{"message":"' + formatAlexaSummary(objHistory['summary']) + '", "from":"' + objHistory['name'] + '"}##');
                                                       }
                                                   }
                                               });
                                            }
                                            
                                            /**
                                            * Formats the Alexa summary text accordingly.
                                            * @param {string} summaryText   The summary text
                                            * @return {string} the formatted summary
                                            */
                                            function formatAlexaSummary(summaryText) {
                                               if (g_capFirstLetters) summaryText = summaryText.replace(/(^|\s)\S/g, l => l.toUpperCase()); // Capitalize if set. https://stackoverflow.com/questions/2332811/
                                               return summaryText;
                                            }
                                            


                                            8d5bc591-942f-4ecd-8d6f-613fa684b2db-grafik.png

                                            1. Ist das von dir gepostete Script identisch mit https://github.com/Mic-M/ioBroker.logparser/blob/master/accessories/alexa-history.js ?
                                            2. Sichergestellt, dass das Script läuft?
                                            3. Was steht genau in "Whitelist UND"? Nur das hier: [Alexa-Log-Script] - ohne Leerzeichen?
                                            4. Adapterversion ist frisch von Github installiert?
                                            5. Getestet mit neuem Alexa-Kommando, nachdem Script und Logparser-Adapter gestartet und ein paar Sekunden gewartet wurde?
                                            BBTown 1 Reply Last reply Reply Quote 0
                                            • First post
                                              Last post

                                            Support us

                                            ioBroker
                                            Community Adapters
                                            Donate
                                            FAQ Cloud / IOT
                                            HowTo: Node.js-Update
                                            HowTo: Backup/Restore
                                            Downloads
                                            BLOG

                                            799
                                            Online

                                            31.7k
                                            Users

                                            79.9k
                                            Topics

                                            1.3m
                                            Posts

                                            adapter filter logparser parser regex
                                            9
                                            40
                                            4307
                                            Loading More Posts
                                            • Oldest to Newest
                                            • Newest to Oldest
                                            • Most Votes
                                            Reply
                                            • Reply as topic
                                            Log in to reply
                                            Community
                                            Impressum | Datenschutz-Bestimmungen | Nutzungsbedingungen
                                            The ioBroker Community 2014-2023
                                            logo