Hi,
I'm trying to use nxlog to to extract three metrics from a .set file. My OS is Windows 10. I edited the .conf file in "C:\Program Files (x86)\nxlog\conf" and it looks like this:
Panic Soft #NoFreeOnExit TRUE
define ROOT C:\Program Files (x86)\nxlog define CERTDIR %ROOT%\cert define CONFDIR %ROOT%\conf define LOGDIR %ROOT%\data define LOGFILE %LOGDIR%\nxlog.log LogFile %LOGFILE%
Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data
<Extension json> Module xm_json </Extension>
<Extension sikora> Module xm_set Fields $Nominal, $PlusTol, $Oval # fields of interest (metrics) FieldTypes string, string, string # type of variable Delimiter ; EscapeControl FALSE </Extension>
<Input sikora_logs> Module im_file File "C:\Users\50051145\Desktop\nx_log\\*.set" # imput file #ReadFromLast True #Recursive True #SavePos True ReadFromLast False Recursive False SavePos False
<Exec>
     if $raw_event =~ /^Macrosezione : (.+)/                                 #  creazione variabile
         {                                                                                                     #
               create_var('macrosection');                                                #
               set_var('macrosection', $1);                                                #
               drop();                                                                                    #
          }
    
         sikora->parse_set();
         delete($EventReceivedTime);
         delete($SourceModuleName);
         delete($SourceModuleType);
         if $raw_event =~ /^Operatore /
         {                                                                                                                                              #  variable definition for the          
               if not defined get_var('start_time')                                                                             #  timestamp
               {                                                                                                                                        #
                     log_debug("parsed_time: " + strptime($time, "%d/%m/%Y %I:%M:%S"));      #
                     create_var('start_time');                                             #
                     set_var('start_time', strptime($time, "%d/%m/%Y %I:%M:%S"));
                     drop();
                }
                else
                {
                     if get_var('start_time') != strptime($time,"%d/%m/%Y %I:%M:%S")
                     {
                          log_debug("old_time: " + get_var('start_time'));
                          log_debug("new_time: ", $time);
                          set_var('start_time', strptime($time,"%d/%m/%Y %I:%M:%S"));
                          drop();
                      }
                 }
        }
       $time = (integer(get_var('start_time')) / 1000000 + integer($time)) * 1000;               # formula to convert timestamp in milliseconds
       $pressure = integer($pressure);
       $macrosection = get_var('macrosection');
       $nominal = get_var('nominal');
       $type = get_var('type');
    
       to_json();
</Exec>
</Input>
<Output out> Module om_file # CreateDir TRUE # File "C:\Users\50051145\Desktop\temp" + $fileName # output file </Output>
<Route 1> Path sikora_logs => out </Route>
When I run the program I expect an output file in a folder on my desktop "C:\Users\50051145\Desktop\temp" but I get nothing. I checked the logs and I get this:
 2019-09-10 18:20:34 ERROR Failed to load module from C:\Program Files (x86)\nxlog\modules\extension\xm_set.dll, The specified module could not be found.  ; 
     The specified module could not be found.  
2019-09-10 18:20:34 ERROR Failed to load module from C:\Program Files (x86)\nxlog\modules\output\om_file                                         #.dll, The specified module 
    could not be found.  ; The specified module could not be found.  
2019-09-10 18:20:34 ERROR Couldn't parse Exec block at C:\Program Files (x86)\nxlog\conf\nxlog.conf:38; couldn't parse statement at line 45, character 28 in 
  C:\Program Files (x86)\nxlog\conf\nxlog.conf; module sikora not found
2019-09-10 18:20:34 ERROR module 'sikora_logs' has configuration errors, not adding to route '1' at C:\Program Files (x86)\nxlog\conf\nxlog.conf:93
2019-09-10 18:20:34 ERROR module 'out' is not declared at C:\Program Files (x86)\nxlog\conf\nxlog.conf:93
2019-09-10 18:20:34 ERROR route 1 is not functional without input modules, ignored at C:\Program Files (x86)\nxlog\conf\nxlog.conf:93
2019-09-10 18:20:34 WARNING no routes defined!
2019-09-10 18:20:34 WARNING not starting unused module sikora_logs
2019-09-10 18:20:34 INFO nxlog-ce-2.10.2150 started
2019-09-11 11:10:27 WARNING stopping nxlog service
2019-09-11 11:10:27 WARNING nxlog-ce received a termination request signal, exiting...
It appers that xm_set.dll library is missing, "The specified module could not be found". I found out in "C:\Program Files (x86)\nxlog\modules\extension" that nxlog doesn't come with a .set library. How can I add this library ?
Thank you
IoT_fra_87 created
I need to create new extension module but I cannot deduce some base code structure for such thing. Is there available some piece of code for new module?
Tuxizm created