Limited Time Offer!

For Less Than the Cost of a Starbucks Coffee, Access All DevOpsSchool Videos on YouTube Unlimitedly.
Master DevOps, SRE, DevSecOps Skills!

Enroll Now

Datadog Tutorials: Send log to Datadog using api through telnet and curl

Reference – https://docs.datadoghq.com/api/latest/logs/

Step 1 – How to get API of Datadog Agent?

Step 2 – Go to Linux Cmd and run following commands.

Using Telnet


$ telnet intake.logs.datadoghq.com 10514
4396f0b432e47383f3dddddd3b1b7 Hell0 Everyone, this is Rajesh

4396f0b432e473ddddddb45cc3b1b7 Hell0 Everyone, this is Rajesh1

4396f0b432e47ddddd17b45cc3b1b7 Hell0 Everyone, this is Rajesh3

87b9dbcda7e5d069cd30a0f68154cca27 {"message":"Welcome to Datadog Session by DevOpsSchool - 1", "ddtags":"env:dev", "ddsource":"devopsschool-1", "hostname":"gs-hostame", "service":"user"}

87b9dbcda7ed5069cd30a0f68154cca27 {"message":"Welcome to Datadog Session by DevOpsSchool - 2", "ddtags":"env:prod", "ddsource":"devopsschool-2", "hostname":"gs-hostame", "service":"user"}

87b9dbcda7ed5069cd30a0f68154cca27 {"message":"Welcome to Datadog Session by DevOpsSchool - 3", "ddtags":"env:qa", "ddsource":"devopsschool-3", "hostname":"gs-hostame", "service":"user"}

87b9dbcda7de5069cd30a0f68154cca27 {"message":"Welcome to Datadog Session by DevOpsSchool - 4", "ddtags":"env:us", "ddsource":"devopsschool-3", "hostname":"gs-hostame", "service":"user"}

Using curl


curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/logs" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: 87b9dbcda7e5069cd30a4468154cca27" \
-d @- << EOF
[
  {
    "ddsource": "nginx",
    "ddtags": "env:staging,version:5.1",
    "hostname": "i-012345678",
    "message": "2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World",
    "service": "payment"
  }
]
EOF

Rajesh Kumar
Follow me
Subscribe
Notify of
guest
0 Comments
Newest
Oldest Most Voted
Inline Feedbacks
View all comments
0
Would love your thoughts, please comment.x
()
x