Suppress NXLog Error Logging from Specific Module

Tags:

#1 casey1234

Hi,

I am using NXLog to run a script via im_exec and the internal restart true feature which restarts my script when it ends.

The thing I'm noticing is that it's filling up the nxlog.log file with error conditions because the script stopped.
ERROR Module test got EOF, process exited?

The script is restarting deliberately so I don't need to know about these specific messages from this specific module.

How can I suppress error logging from a specific module?

Have a wonderful day!

NOTE: I was able to get it working a different way.

The solution involves executing a script on startup to get the initial useful data and send it to a log file. From there NXLog searches for that file and copies it to gateway.log. The input module im_file then reads that file which initiates the heartbeat. The way that im_file works is that it caches the file and won’t read from it again unless the file changes(modifying last modified doesn’t appear to count as a change). To that end I added logic that would periodically delete and re-copy the file. In this way im_file has a new file to read from, and thus send the heartbeat.

While NXLog logs when the new files are read, they are logged as WARNING, not ERROR, so you can set the LogLevel to ERROR

<Extension _filedelete>
    Module xm_fileop
    <Schedule>
        Every 25 sec
        <Exec>
            if file_exists('%GATEWAY%.log') file_remove('%GATEWAY%.log');
			if file_exists('%GATEWAY%') file_copy('%GATEWAY%', '%GATEWAY%.log');
        </Exec>
    </Schedule>
</Extension>

<Input ipGateway>
	Module  im_file
    PollInterval 60
	ReadFromLast false
	SavePos false
    File    '%GATEWAY%.log'
	<Exec>
		$gateway = $raw_event;
    </Exec>
</Input>

This is not meant to be some kind of groundbreaking discovery. I only post it here in case someone else ends up trying to figure out this requirement.

Hope this helps!

#2 manuel.munozDeactivated Nxlog ✓
#1 casey1234
Hi, I am using NXLog to run a script via im_exec and the internal restart true feature which restarts my script when it ends. The thing I'm noticing is that it's filling up the nxlog.log file with error conditions because the script stopped. ERROR Module test got EOF, process exited? The script is restarting deliberately so I don't need to know about these specific messages from this specific module. How can I suppress error logging from a specific module? Have a wonderful day! NOTE: I was able to get it working a different way. The solution involves executing a script on startup to get the initial useful data and send it to a log file. From there NXLog searches for that file and copies it to gateway.log. The input module im_file then reads that file which initiates the heartbeat. The way that im_file works is that it caches the file and won’t read from it again unless the file changes(modifying last modified doesn’t appear to count as a change). To that end I added logic that would periodically delete and re-copy the file. In this way im_file has a new file to read from, and thus send the heartbeat. While NXLog logs when the new files are read, they are logged as WARNING, not ERROR, so you can set the LogLevel to ERROR <Extension _filedelete> Module xm_fileop <Schedule> Every 25 sec <Exec> if file_exists('%GATEWAY%.log') file_remove('%GATEWAY%.log'); if file_exists('%GATEWAY%') file_copy('%GATEWAY%', '%GATEWAY%.log'); </Exec> </Schedule> </Extension> <Input ipGateway> Module im_file PollInterval 60 ReadFromLast false SavePos false File '%GATEWAY%.log' <Exec> $gateway = $raw_event; </Exec> </Input> This is not meant to be some kind of groundbreaking discovery. I only post it here in case someone else ends up trying to figure out this requirement. Hope this helps!

Casey,

Unfortunately, I don't think you can delete or change the type of logging level depending on the module.