DatadogのモニターやPipelineを設定した後にテストをしたいと思います。
コンテナですと、ログテストが難しいので、curlからできることも覚えておきましょう。
US1の場合: https://http-intake.logs.datadoghq.com/api/v2/logs
AP1の場合: https://http-intake.logs.ap1.datadoghq.com/api/v2/logs
## Multi Raw Messages
# Submit log string.
# Curl command
curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/logs" \
-H "Accept: application/json" \
-H "Content-Type: text/plain" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
2019-11-19T14:37:58,995 INFO [process.name][20081] Hello
2019-11-19T14:37:58,995 INFO [process.name][20081] World
EOF
## Simple Raw Message
# Submit log string. Log attributes can be passed as query parameters in the URL. This enables the addition of tags or the source by using the `ddtags` and `ddsource` parameters: `?host=my-hostname&service=my-service&ddsource=my-source&ddtags=env:prod,user:my-user`.
# Curl command
curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/logs" \
-H "Accept: application/json" \
-H "Content-Type: text/plain" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
2019-11-19T14:37:58,995 INFO [process.name][20081] Hello World
EOF
curl -X POST "https://http-intake.logs.datadoghq.com/api/v2/logs" \
-H "Accept: application/json" \
-H "Content-Type: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-d @- << EOF
{
"ddsource": "taromn",
"ddtags": "env:staging,version:1.0",
"hostname": "i-abcde",
"message": "Taromn Awesome Log",
"service": "taromn"
}
EOF