Andrei Staravoitau
Andrei Staravoitau

Reputation: 37

Datadog not recognize tags in the logs

I'm sending logs to the datadog as a json. Example

{
    "id": "xyz",
    "content": {
        "timestamp": "2022-01-11T14:10:58.413Z",
        "tags": ["source:apigee", "env:ops"]
    }
}

Datadog does not see my tags. Where in the log do I need to put tags section to make it work?

Upvotes: 0

Views: 1928

Answers (1)

bwest
bwest

Reputation: 9814

You say you are sending JSON, but the Apigee policy you've provided looks like it's using Syslog. If <log_msg> in your example is JSON, then the structure of the payload in your question is incorrect, it should be something like

{"message":"json formatted log", "ddtags":"source:apigee,env:ops", "ddsource":"my-integration", "hostname":"my-hostname", "service":"my-service"}

I think, based on this format, you need to add your tags between <api_key> and <log_msg>, like this:

 <Syslog>
   <Message variablePrefix="%" variableSuffix="#">
    <api_key> [ddtags="source:apigee,env:ops"] <log_msg>
   </Message>
  ...

Hopefully that helps. If you share an example of some contents of log_msg I can debug more.

Upvotes: 1

Related Questions