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

Filtering log entries #198

Closed
spruc opened this issue Jun 21, 2023 · 6 comments
Closed

Filtering log entries #198

spruc opened this issue Jun 21, 2023 · 6 comments

Comments

@spruc
Copy link

spruc commented Jun 21, 2023

Does this extension support filtering log entries based on some criteria such that I can forward only a subset of my logs to Splunk? What I'm trying to do is log some entries to stdout and some to Splunk without having to build a Splunk client myself.

@vietk
Copy link
Contributor

vietk commented Jun 21, 2023

Hello

No, and I think it would be useless, you could use a custom logging filter attached to this handler.

Having said that we don't test the specific behaviour, but on the paper it should work since it's part of the framework

Regards

@rquinio1A
Copy link
Member

No, and I think it would be useless, you could use a custom logging filter attached to this handler.
Having said that we don't test the specific behaviour, but on the paper it should work since it's part of the framework

Probably we'd need a quarkus.log.handler.splunk.filter ?

For filtering by log category, there's a link to #156 (i.e. be able to associate splunk handler to only specific loggers) though I'm not clear if you could also restrict log categories on the default log handler.

Using purely configuration today, there's only the log level (quarkus.log.handler.splunk.level) to restrict which logs events go to splunk.

@spruc
Copy link
Author

spruc commented Jun 21, 2023

No, and I think it would be useless, you could use a custom logging filter attached to this handler.
Having said that we don't test the specific behaviour, but on the paper it should work since it's part of the framework

As @rquinio1A pointed out this requires the filter property to exist on the handler, so I don't think there currently is a way to do attach the filter to the handler.

@vietk
Copy link
Contributor

vietk commented Jun 21, 2023

There's a setFilter on the ExtHandler the base class of the SplunkHandler

image

In my opinion, quarkus dev did not reinvent the wheel at took advantage of the existing infrastructure , the best is to test

@spruc
Copy link
Author

spruc commented Jun 21, 2023

In my opinion, quarkus dev did not reinvent the wheel at took advantage of the existing infrastructure , the best is to test

I have no idea what you're trying to say there.

As for your screenshot, I don't see how that's useful to me. The SplunkLogHandler is not a CDI bean so I can't get a reference to it.

Consider this a request to add the filter property such that I can attach a filter to the handler—if you're not interested in implementing it, I'll gladly look for other ways to get this done.

@vietk
Copy link
Contributor

vietk commented Jun 21, 2023

I have no idea what you're trying to say there.
As for your screenshot, I don't see how that's useful to me. The SplunkLogHandler is not a CDI bean so I can't get a > reference to it.

Hey, I am just trying to help here, no need to be rude or impatient. You can ask for precision if you don't understand, I would happy to clarify my thoughts here.

Anyway, for reference, I've been put on the wrong track because of the name of quarkusio/quarkus#27864.
It's possible to set a filter on the file, console, syslog built-in handlers only.

Probably we'd need a quarkus.log.handler.splunk.filter ?

Yes in a smart way because LogSetupRecorder will erase it with an instance of LogCleanupFilter, we would need to override setFilter() and compose the filters.
But it's a hacky way, that would be up to the LogSetupRecorder to take care of that.

I'll gladly look for other ways to get this done.

Good luck

@vietk vietk closed this as completed Jun 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants