Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update HttpEventCollectorResendMiddleware.cs for splunk connection fa… #65

Open
wants to merge 2 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,8 @@ public HttpEventCollectorResendMiddleware(int retriesOnError)
}
if (statusCode != HttpStatusCode.OK || webException != null)
{
// when splunk connectivity is failed then set status to failed.This status help to switch target in nlog config file
GlobalDiagnosticsContext.Set("splunkstatus", "failed");
throw new HttpEventCollectorException(
code: statusCode == HttpStatusCode.OK ? HttpStatusCode.InternalServerError : statusCode,
webException: webException,
Expand All @@ -123,7 +125,11 @@ public HttpEventCollectorResendMiddleware(int retriesOnError)
serializedEvents: System.Text.Encoding.UTF8.GetString(serializedEvents)
);
}
else{
// when splunk connectivity is failed then set status to failed
GlobalDiagnosticsContext.Set("splunkstatus", "success");
}
return response;
}
}
}
}
2 changes: 2 additions & 0 deletions src/build-nuget-packages.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@ Param(
)
cd .\NLog.Targets.Splunk
Write-Output "Building release $versionSuffix nuget packages..."
Write-Output "Restoring NuGet packages..."
dotnet restore
dotnet pack --configuration Release --include-symbols --version-suffix $versionSuffix
Write-Output "Moving $versionSuffix nuget packages to releases folder..."
Move-Item .\bin\Release\*.nupkg ..\..\releases -Force
Expand Down