-
Notifications
You must be signed in to change notification settings - Fork 293
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
Agent log output in JSON? #1109
Comments
Apologies for the delay @dpratt. Can you open a support ticket so we can properly track this feature request? Thanks. |
I'm interested in this as well. |
Is there upside that you might be able to share @dpratt ? I have same issue. |
@jeremy-lq has this been implemented? Is there another ticket/issue where this is being tracked? |
@svetozar02 cannot agree more with your statement. DD does a statement in the docs and completely contradicts it with its software |
Supporting development of this feature (which I see as a bug) - for the reasons others have described. Our monitoring team has to spend time looking at every alert, and these are fruitless ones. We are increasing the risk of alert fatigue as well. |
This has become a huge issue for us enabling Datadog application security. Enabling it means you get potential logs like:
You can clearly see in the log its a warning, in this case about a potential security issue but I quote from support case "It looks like these logs may be going to stderr, is that right? If so, we assign the ERROR status to all stderr logs by default (noted in the Important Notes here: https://docs.datadoghq.com/agent/docker/log/?tab=hostagent#installation )." This means our applications are now flooded with error logs that we can't really do anything with. |
@thearegee I've seen support case, you are talking about. I'm sorry for that bad experience. There was an AppSec issue which cause spams WARN message for every requests. But now it's fixed and will be available in coming release (today). |
@ValentinZakharov thank you thats great news and thanks for getting this in so quickly. We will upgrade this today and see how it looks. If we can help with logging please let me know |
Hi @ValentinZakharov ! Any update about the rework on logging system? |
Any movement on this? 3 years later and we're still having to configure datadog agent to log to System.out so as not to spam fake errors to the datadog log... which is kinda funny/annoying. |
I'm sorry for the delay. Reworking of current logging system been postponed due critical impact on existing customers. However, we are trying to fix customer's issues with minor fixes.
Ref: documentation Please, let me know, if that way, can't solve the problem. |
The solution above doesn't really solve the problem, in that if you redirect the log messages to a file, they'll likely just be ignored since they're not going to stderr/stdout. Additionally, if you're running in a container, this is likely an anti-pattern since you'll be writing to an ephemeral file that will eventually just be discarded when your container exits. The real solution here would be to do one of two things -
|
@dpratt thanks for sharing details of proposed solution. |
Just in case it helps anyone else -- Our office has also filed a feature request ticket with DD Support (892588) providing a link to this GitHub issue. No new timing or announcements are available, but we've added our voice in support of a solution. |
I'm adding our account to the list of affected customers who would like to see a resolution. Given how hard it is to build dd-trace-java on our side, and the fact that the agent's classloader is fully locked, short of monkeypatching classfiles we have no way of getting properly structured logs out of the APM agent. |
We also stumbled about this in our trial phase. DataDog recommends JSON logging in its own docs, but then the agent logs get marked as errors in the DataDog web ui. |
Does setting the |
@briceburg, I assume the above posters are talking about the |
OK yes, I struggle with this too across the various ddtrace implementions. In an effort to "have all logs in JSON", I reduced the output of ddtrace to "WARNING" by setting the |
When can we expect this problem to be fixed? 😞 I have tried |
I was able to configure the java agent log messages to go to stdout and also get the messages correctly parsed by Datadog. TL;DRIf you just want Datadog to stop identifying the agent logs messages as errors, add the following when running your application via
If you also want these logs to get parsed by datadog, add the following:
Explanation:About logs going to stderr:The default value for
Changing this property to use About getting Datadog to parse the logsThe default for
The default date format causes the agent log messages not to be accepted by any of Datadog's default formats for parsing Java logs: Simply changing the log date format to |
Another workaround (only for user that uses DataDog LogExplorer feature), is to create a new Grok processor in your DataDog log pipeline. You also can add new rules to existing default Java processors. I added the same as the default Java and update the date pattern Rule:
Helper rule:
|
Thank you @gabrielhof , I think that the system property should not have quotes, or if it should, then you should quote the whole thing. At least for me in a Dockerfile the quotes just cause quotes to appear around the timestamp. i.e., I think changing this:
to
|
@nasilrgb Were you able to prevent that log from appearing at the error level? Updating our Dockerfile with the suggestions above, i.e.:
We can ensure all other Datadog agent logs have the correct log level. This, for some reason, still logs at the error level. |
We run all our services in docker containers in a k8s cluster, as I suspect quite a few Datadog users do, and as such we have our standard boilerplate set to emit all logs from all sources (channeled through slf4j) as properly formatted single line JSON. This allows for the Datadog agent to pick up and properly index logs and deal with things like stack traces in a sane fashion.
For the most part, this works quite well, except for log messages printed to standard out by the datadog java agent. Since the slf4j infrastructure at that level is loaded and configured in a different classloader, we don't really have any way to influence it's output - it appears to just be using the stock simple slf4j logger implementation, which only really allows for coarse grained configuration of log levels.
Is there a mechanism by which we could have the java agent use logback or some other slf4j binding that outputs JSON instead? We have people getting woken up at all hours of the night due to errors generating alerts because the DD log infrastructure interprets anything that can't be parsed as JSON at the ERROR level. We've mitigated a bunch of this by adding -Ddatadog.slf4j.simpleLogger.defaultLogLevel=WARN to our JVM launch parameters, but there's still a bunch of stuff that occasionally gets through.
The text was updated successfully, but these errors were encountered: