Appending GUID to logs

Tags:

#1 logman29

I am trying to append a pre-defined GUID to some application log files. The log files are written in JSON and I would like to append these logs with a GUID. 

I have defined the GUID in my config file with the variable CUSTOMER_TOKEN.

I am not sure how to accomplish this using the raw_event + function within my config settings. Sorry for the basic question. I read the community reference manual a few times, but couldn't quite figure out how to use the raw_event + to append the CUSTOMER_TOKEN to the logs. 

Thank you in advance.

Here is my config file:

#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
define CERTDIR %ROOT%\cert
define CUSTOMER_TOKEN 10401ffc-42c2-49a6-9292-7eb31c9df605
 
Moduledir %ROOT%\modules
CacheDir %ROOT%\data
Pidfile %ROOT%\data\nxlog.pid
SpoolDir %ROOT%\data
LogFile %ROOT%\data\nxlog.log
 
 
# Include fileop while debugging, also enable in the output module below
#<Extension fileop>
#    Module      xm_fileop
#</Extension>

<Extension json>
    Module      xm_json
</Extension>

<Input MonitoringAgent>
   Module   im_file
   File     "C:\Users\logman\AppData\Local\Temp\MonitoringAgent.log"
   #SavePos  TRUE
</Input>
  
<Output out>
   Module om_file
   File "C:\Users\logman\Desktop\App_Logs\Logs.txt"
</Output>
 
<Route 1>
   Path MonitoringAgent => out
</Route>

 

#2 adm Nxlog ✓
#1 logman29
I am trying to append a pre-defined GUID to some application log files. The log files are written in JSON and I would like to append these logs with a GUID.  I have defined the GUID in my config file with the variable CUSTOMER_TOKEN. I am not sure how to accomplish this using the raw_event + function within my config settings. Sorry for the basic question. I read the community reference manual a few times, but couldn't quite figure out how to use the raw_event + to append the CUSTOMER_TOKEN to the logs.  Thank you in advance. Here is my config file: #define ROOT C:\Program Files\nxlog define ROOT C:\Program Files (x86)\nxlog define CERTDIR %ROOT%\cert define CUSTOMER_TOKEN 10401ffc-42c2-49a6-9292-7eb31c9df605   Moduledir %ROOT%\modules CacheDir %ROOT%\data Pidfile %ROOT%\data\nxlog.pid SpoolDir %ROOT%\data LogFile %ROOT%\data\nxlog.log     # Include fileop while debugging, also enable in the output module below #<Extension fileop> #    Module      xm_fileop #</Extension> <Extension json>     Module      xm_json </Extension> <Input MonitoringAgent>    Module   im_file    File     "C:\Users\logman\AppData\Local\Temp\MonitoringAgent.log"    #SavePos  TRUE </Input>    <Output out>    Module om_file    File "C:\Users\logman\Desktop\App_Logs\Logs.txt" </Output>   <Route 1>    Path MonitoringAgent => out </Route>  

Exec $raw_event = $raw_event + ' ' + '%CUSTOMER_TOKEN%';

I have a feeling that this is not exactly what you want since the input is in JSON but you asked for appending it.