how to exclude filenames

This support forum board is for support questions relating to Nagios Log Server, our solution for managing and monitoring critical log data.
Locked
newmember
Posts: 43
Joined: Sat Sep 03, 2016 2:54 pm

how to exclude filenames

Post by newmember »

How do I exclude files with "snapshot" in the end of the filename?:
SIP_Server.20190512_020807_602.snapshot.log

This the standard name format for the log files I want look like this:
SIP_Server.20190512_020807_800.log



<Input sip_p>
Module im_file
File 'E:\Logs\SIP_Server.*.log'
InputType sip_multiline_header
SavePos FALSE
</Input>
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: how to exclude filenames

Post by scottwilkerson »

I believe you can use something like this

Code: Select all

<Input sip_p>
Module im_file
File 'E:\Logs\SIP_Server.*.log'
$FileName = file_name();
if $FileName =~ /.*snapshot.*/s drop();
InputType sip_multiline_header
SavePos FALSE
</Input>
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked