Display log file path field
Posted: Tue Sep 14, 2021 7:09 pm
Hi,
We would like to display the path log file location when viewing the events in the dashboard. Is this possible?
I can see for Windows Event Log events I can see Path field, but when I am pulling logs from a log file it doesnt have the "Path" field.
Currently it is showing only the following in JSON
{
"_index": "logstash-2021.09.13",
"_type": "eventlog",
"_id": "AqvmKjmtq-QHErH_ejZB",
"_score": null,
"_source": {
"EventReceivedTime": "2021-09-13 07:15:03",
"SourceModuleName": "log_file_1",
"SourceModuleType": "im_file",
"message": "this is the message in the log",
"@version": "1",
"@timestamp": "2021-09-12T21:15:03.362Z",
"host": "1.1.1.1",
"port": 123456,
"type": "eventlog"
},
"sort": [
null,
1631654103362
]
}
## See the nxlog reference manual at
## http://nxlog.org/nxlog-docs/en/nxlog-re ... anual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
define CERT %ROOT%\cert
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>
<Extension syslog>
Module xm_syslog
</Extension>
<Input internal>
Module im_internal
</Input>
# Watch your own files
<Input file1>
Module im_file
File '%ROOT%\data\nxlog.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>
<Input log_file_1>
Module im_file
File 'C:\temp\logfile.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>
# Windows Event Log
<Input eventlog>
# Uncomment im_msvistalog for Windows Vista/2008 and later
Module im_msvistalog
# Uncomment im_mseventlog for Windows XP/2000/2003
# Module im_mseventlog
</Input>
<Output out>
Module om_tcp
Host logserver.acme.com
Port 3515
Exec $tmpmessage = $Message; delete($Message); rename_field("tmpmessage","message");
Exec $raw_event = to_json();
# Uncomment for debug output
#Exec file_write('%ROOT%\data\nxlog_output.log', $raw_event + "\n");
</Output>
<Route 1>
Path internal, file1, log_file_1, eventlog => out
</Route>
Where as in the JSON for Windows Event logs I can see
"Path": "C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts",
"EventReceivedTime": "2021-09-15 09:39:51",
"SourceModuleName": "eventlog",
"SourceModuleType": "im_msvistalog",
Can the Path be available for both Windows and Linux servers?
We would like to display the path log file location when viewing the events in the dashboard. Is this possible?
I can see for Windows Event Log events I can see Path field, but when I am pulling logs from a log file it doesnt have the "Path" field.
Currently it is showing only the following in JSON
{
"_index": "logstash-2021.09.13",
"_type": "eventlog",
"_id": "AqvmKjmtq-QHErH_ejZB",
"_score": null,
"_source": {
"EventReceivedTime": "2021-09-13 07:15:03",
"SourceModuleName": "log_file_1",
"SourceModuleType": "im_file",
"message": "this is the message in the log",
"@version": "1",
"@timestamp": "2021-09-12T21:15:03.362Z",
"host": "1.1.1.1",
"port": 123456,
"type": "eventlog"
},
"sort": [
null,
1631654103362
]
}
## See the nxlog reference manual at
## http://nxlog.org/nxlog-docs/en/nxlog-re ... anual.html
## Please set the ROOT to the folder your nxlog was installed into,
## otherwise it will not start.
#define ROOT C:\Program Files\nxlog
define ROOT C:\Program Files (x86)\nxlog
define CERT %ROOT%\cert
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>
<Extension syslog>
Module xm_syslog
</Extension>
<Input internal>
Module im_internal
</Input>
# Watch your own files
<Input file1>
Module im_file
File '%ROOT%\data\nxlog.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>
<Input log_file_1>
Module im_file
File 'C:\temp\logfile.log'
SavePos TRUE
Exec $Message = $raw_event;
</Input>
# Windows Event Log
<Input eventlog>
# Uncomment im_msvistalog for Windows Vista/2008 and later
Module im_msvistalog
# Uncomment im_mseventlog for Windows XP/2000/2003
# Module im_mseventlog
</Input>
<Output out>
Module om_tcp
Host logserver.acme.com
Port 3515
Exec $tmpmessage = $Message; delete($Message); rename_field("tmpmessage","message");
Exec $raw_event = to_json();
# Uncomment for debug output
#Exec file_write('%ROOT%\data\nxlog_output.log', $raw_event + "\n");
</Output>
<Route 1>
Path internal, file1, log_file_1, eventlog => out
</Route>
Where as in the JSON for Windows Event logs I can see
"Path": "C:\\Windows\\system32\\config\\systemprofile\\AppData\\Roaming\\Microsoft\\Windows\\Network Shortcuts",
"EventReceivedTime": "2021-09-15 09:39:51",
"SourceModuleName": "eventlog",
"SourceModuleType": "im_msvistalog",
Can the Path be available for both Windows and Linux servers?