Logs are being sent to the local fluentd instance just fine, and with the forwarding rules in place, are being transmitted out to the main aggregator instance as well. However, I'm trying to make sure that if the local fluentd is not available for some reason, that the logs will be written to a local file to be gathered manually when we fix the problem.
If I kill the local fluentd instance, so that the connection will fail, the fallback target is not being called and no log file is present in the given directory. Am I missing something, or configured something incorrectly?
Here is my config (I was messing with the timeout and buffer sizes thinking that may have something to do with it) :
var logLayout = new SimpleLayout("${longdate} [${level}] ${message} ${exception}");
var config = new LoggingConfiguration();
var fallbackTarget = new FallbackGroupTarget
{
Name = "fluentd-fallback",
ReturnToFirstOnSuccess = false
};
var fluentdTarget = new Fluentd
{
Name = "fluentd",
Layout = logLayout,
NoDelay = true,
SendTimeout = 1,
ReceiveTimeout = 1,
LingerEnabled = false,
Tag = "new-api"
};
var fileTarget = new FileTarget
{
Name = "fluentd-file-fallback",
FileName = "C:\\logs\\fluent-failed.txt",
Layout = logLayout,
Encoding = Encoding.UTF8
};
fallbackTarget.Targets.Add(fluentdTarget);
fallbackTarget.Targets.Add(fileTarget);
var bufferWrapper = new BufferingTargetWrapper
{
Name = "fluentd-buffer",
OverflowAction = BufferingTargetWrapperOverflowAction.Flush,
SlidingTimeout = true,
WrappedTarget = fallbackTarget,
BufferSize = 1,
FlushTimeout = 50
};
config.AddTarget("fluentd-buffer", bufferWrapper);
config.AddRuleForAllLevels(bufferWrapper);
var loggerFactory = new LogFactory(config)
{
ThrowConfigExceptions = true,
ThrowExceptions = true
};
InternalLogger.LogFile = "C:\\logs\\nlog-internal.txt";
InternalLogger.LogLevel = LogLevel.Debug;
return loggerFactory.GetLogger("burtonr");
I should note that the internal log does appear, so there shouldn't be any issues with the file system permissions. The internal log file looks like this:
Logs are being sent to the local fluentd instance just fine, and with the forwarding rules in place, are being transmitted out to the main aggregator instance as well. However, I'm trying to make sure that if the local fluentd is not available for some reason, that the logs will be written to a local file to be gathered manually when we fix the problem.
If I kill the local fluentd instance, so that the connection will fail, the fallback target is not being called and no log file is present in the given directory. Am I missing something, or configured something incorrectly?
Here is my config (I was messing with the timeout and buffer sizes thinking that may have something to do with it) :
I should note that the internal log does appear, so there shouldn't be any issues with the file system permissions. The internal log file looks like this: