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

Fix for #205 allow collector path in host url #211

Merged
merged 2 commits into from
Jun 5, 2024
Merged
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
1 change: 1 addition & 0 deletions src/Serilog.Sinks.Splunk/ConfigurationDefaults.cs
Original file line number Diff line number Diff line change
Expand Up @@ -14,5 +14,6 @@ internal static class ConfigurationDefaults
/// https://docs.splunk.com/Documentation/Splunk/9.1.0/Data/UsetheHTTPEventCollector#Send_data_to_HTTP_Event_Collector_on_Splunk_Enterprise
/// </remarks>
internal const string DefaultEventCollectorPath = "services/collector/event";
internal const string DefaultCollectorPath = "services/collector";
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
// Copyright 2016 Serilog Contributors
// Copyright 2016 Serilog Contributors
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
Expand All @@ -23,7 +23,7 @@ internal class EventCollectorRequest : HttpRequestMessage
{
internal EventCollectorRequest(string splunkHost, string jsonPayLoad, string uri = ConfigurationDefaults.DefaultEventCollectorPath)
{
var hostUrl = splunkHost.Contains(ConfigurationDefaults.DefaultEventCollectorPath)
var hostUrl = splunkHost.Contains(ConfigurationDefaults.DefaultCollectorPath)
? splunkHost
: $"{splunkHost.TrimEnd('/')}/{uri.TrimStart('/').TrimEnd('/')}";

Expand All @@ -32,4 +32,4 @@ internal EventCollectorRequest(string splunkHost, string jsonPayLoad, string uri
Method = HttpMethod.Post;
}
}
}
}
Loading