-
Notifications
You must be signed in to change notification settings - Fork 47
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
Feature/161 subsecond decimals #172
Conversation
f0dd19e
to
734392e
Compare
@VictorioBerra If you have time I would like your opinion/review on these changes. Thank you |
Looks like the link to the docs is dead: http://dev.splunk.com/view/SP-CAAAE6P Is there a more up to date link describing the tiemstamp format and the precision? |
https://docs.splunk.com/Documentation/Splunk/9.2.0/SearchReference/Commontimeformatvariables it looks like 3, 6 or 9 decimals are supported, so the PR probably needs to be updated to use an enum for millisecond, microseconds or nanoseconds. |
That is very helpful! Thank you.
…On Sat, Mar 16, 2024, 4:08 PM Jeff Parker, PE ***@***.***> wrote:
https://docs.splunk.com/Documentation/Splunk/9.2.0/SearchReference/Commontimeformatvariables
it looks like 3, 6 or 9 decimals are supported, so the PR probably needs to
be updated to use an enum for millisecond, microseconds or nanoseconds.
—
Reply to this email directly, view it on GitHub
<#172 (comment)>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAWMN27KKG6WPJCQJGRZHT3YYSYFPAVCNFSM6AAAAABEY7NQ7GVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDAMBSGEZTGMRTGE>
.
You are receiving this because you were mentioned.Message ID:
***@***.***>
|
I've updated this PR with the enum, added unit tests and updated documentation links. |
I've updated this PR with the enum, added unit tests and updated documentation links. |
@@ -174,8 +182,11 @@ public void Format(LogEvent logEvent, TextWriter output) | |||
JsonValueFormatter.WriteQuotedJsonString(logEvent.MessageTemplate.Text, output); | |||
} | |||
|
|||
output.Write(",\"RenderedMessage\":"); | |||
JsonValueFormatter.WriteQuotedJsonString(logEvent.RenderMessage(_formatProvider), output); | |||
if (!_renderMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Should this logic be the other way round? ie if (_renderMessage)
to match the _renderTemplate logic above?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you are right. I removed the !
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks for the fix
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Small comment as to whether _renderMessage=true means to enable or disable the field from being sent to splunk, to match the meaning for _renderTemplate=true
@@ -182,7 +182,7 @@ public void Format(LogEvent logEvent, TextWriter output) | |||
JsonValueFormatter.WriteQuotedJsonString(logEvent.MessageTemplate.Text, output); | |||
} | |||
|
|||
if (!_renderMessage) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
thanks
@VictorioBerra I added the test code and splunk props.conf to make this work in the sample project. I've also verified that microseconds (6) work, but I couldn't get Splunk ingestion to work with nanoseconds (9). I believe this is on the Splunk side but I'm not sure what is needed. |
- add new tests - add a docker-compose vscode project - allow subsecond precision.
677f328
to
b335663
Compare
Thanks for doing that, @EEParker can you share the changes you made to the props.conf? Maybe I could post on the Splunk forums about this? |
props.conf TIME_PREFIX = \"time\"\:\s*\"
TIME_FORMAT = %Y-%m-%dT%H:%M:%S.%9N%Z |
Are you comfortable with merging this? I think a follow-up PR can be made to address any splunk samples that need to be changed. I would like to merge this in before #174. |
@EEParker Yeah id say go ahead, I like the addition of the .editoconfig and the docker additions. |
* Bump System.Net.Http from 4.3.3 to 4.3.4 in /sample/Sample Bumps System.Net.Http from 4.3.3 to 4.3.4. Signed-off-by: dependabot[bot] <support@github.com> * Bump System.Net.Http from 4.3.0 to 4.3.4 in /src/Serilog.Sinks.Splunk Bumps System.Net.Http from 4.3.0 to 4.3.4. Signed-off-by: dependabot[bot] <support@github.com> * Bump System.Net.Http in /test/Serilog.Sinks.Splunk.Tests Bumps System.Net.Http from 4.3.3 to 4.3.4. Signed-off-by: dependabot[bot] <support@github.com> * Bump System.Net.Http from 4.3.0 to 4.3.4 in /src/Serilog.Sinks.UDP Bumps System.Net.Http from 4.3.0 to 4.3.4. Signed-off-by: dependabot[bot] <support@github.com> * add default batch config * Update expired GitHub Key * add default batch config * Update expired GitHub Key * fix bug dispose (#153) * Regenerate API Key for NuGet * Splunk 9.1 + .NET 6 (#166) * Sample: Target net6.0. Added additional logging statements. * Docker: Splunk 9.1. * Tests: Target net6.0 and updated nuget packages. * Added constant for services/collector. Event request trims / from uri. Updated collector URL for Splunk 9.1 * Update to serilog periodic batching 4.x (#168) * Updated dependencies to Serilog 3.1 and Periodic Batching Sink to 4.0.0 * Update version to 4.0.0 due to the breaking constructor changes on the EventCollectorSink * Update Dockerfile with net6.0 versions * Use the latest version of Splunk The 7.2 label does not appear to be available anymore. * Add in missing build for net6.0 * Use forward slash for ignore This should work on Windows as well * Use the same Framework reference for the sample Everything else is using at least net6.0 so the Sample should as well --------- Co-authored-by: Justin Pfifer <justin.pfifer@carvana.com> Co-authored-by: Jeff Parker, PE <EEParker@users.noreply.github.com> * dotnet 8.0 updates (#171) * Feature/161 subsecond decimals (#172) * Fixes #161 add subsecond decimal configuration * Fixes #167 Add a flag for RenderedMessage * Update SubSecondPrecision to use an enum. Based on 3,6,9 decimals, see https://docs.splunk.com/Documentation/Splunk/9.2.0/SearchReference/Commontimeformatvariables * Add unit tests and update documentation * Invert renderMessage check * Update sample docker-compose project - add new tests - add a docker-compose vscode project - allow subsecond precision. * Add comment for configuring splunk * Fix formatting for nanoseconds * Enable all tests in sample app --------- Co-authored-by: Victorio Berra <toryberra@gmail.com> * Set up GitHub Actions (#174) * Enable GitHub Actions * Main branch is called master in this repo * Ignore .idea * No need to offset builds by 200 * work on build for new project format * add automatic release notes --------- Co-authored-by: EEParker <EEParker@users.noreply.github.com> * Filter branches that push to nuget (#177) * Security Policy, scanning and dependency updates (#176) * Add dependabot configuration * Add codeql * Add security policy * Update dependabot.yml add newline * update branches * Update SECURITY.md * Readme and package license fix * Update dotnet pack command line --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Matthew Erbs <matthew.erbs@merbla.com> Co-authored-by: Mohsen Rajabi <m.kabir8895@gmail.com> Co-authored-by: Havagan <Havagan@users.noreply.github.com> Co-authored-by: Justin Pfifer <61801015+jpfifer@users.noreply.github.com> Co-authored-by: Justin Pfifer <justin.pfifer@carvana.com> Co-authored-by: Victorio Berra <toryberra@gmail.com> Co-authored-by: Nicholas Blumhardt <nblumhardt@nblumhardt.com>
The first commit adds a sub-second decimal option to address #161.
The second commit adds a flag for disabling RenderedMessage per #167.
These both seem optional, but could be nice to have. I've included them here for review.