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

Layout doesn't seem to control formatting #35

Open
ignusfast opened this issue Aug 24, 2019 · 4 comments
Open

Layout doesn't seem to control formatting #35

ignusfast opened this issue Aug 24, 2019 · 4 comments

Comments

@ignusfast
Copy link

I'm trying to use the following target Layout to get NLog to send the message verbatim, but it still wraps it in a bunch of unnecessary data... The same target Layout works fine for file logging.

_splunkTarget = new SplunkHttpEventCollector() {
ServerUrl = new Uri(SplunkURL),
Token = SplunkHecToken,
Channel = SplunkHecToken,
RetriesOnError = 1,
MaxConnectionsPerServer = 20,
Layout = "${message}"
};

@DarekDan
Copy link

The Layout is hard coded just $message, however, later completely overwritten by a Json formatter, also hardcoded content and layout. I believe it would be more respectful to allow for a layout configuration element, since NLog offer a Json layout component: https://github.com/NLog/NLog/wiki/JsonLayout

@AlanBarber
Copy link
Owner

Yeah, I can see how this might be useful. The original was designed with assumptions about what info should be sent into the splunk logs.

I'll start some research into what it would take to rework this around the JsonLayout component.

@Haddox19
Copy link

Haddox19 commented Oct 3, 2019

Hello, Has this been implemented? We were looking at using this package however it does not allow us to format our messages the way we need to for our organization.

@DarekDan
Copy link

DarekDan commented Oct 3, 2019

If you need special formatting you can try my NLog.Targets.HTTP combined with JSON Formatter. https://www.nuget.org/packages/NLog.Targets.Http/

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

4 participants