Log event can be sent via POST request to the log ingestion API. There are two ways to send log events to the API:
- Log Ingestion API via Ingestion endpoint and HTTP Header: In this case, you can add the
x-p-stream
header to the request to specify the stream name. If the stream does not exist, it will be created automatically. This is useful for automation scenarios where you want to create a stream and send logs to it via agents. - Log Ingestion API via Stream endpoint: In this approach you need to create a stream first, using the Create Stream API. Once the stream is created, you can send logs to the stream ingestion API endpoint -
http://{{endpoint}}/api/v1/logstream/{{stream_name}}
. This API doesn't require any headers for stream name.
Note\
- To add metadata with a log event, please add the a HTTP header
X-P-Meta-<key>
with the value of the metadata. For example, to add a metadatauser_id
with value123
, you can add a headerX-P-Meta-user_id: 123
. - To add a tag with a log event, please add the a HTTP header
X-P-Tag-<key>
with the value of the tag. For example, to add a tagapp
with valuekafka
, you can add a headerX-P-Tag-app: kafka
.