The Log
The logs from each api call can be extracted from gecholog
by the nats2log
standard library processor that writes logs to file or to log store endpoint. You can also create your own connection to nats
and subscribe to the topic_logger_exact
topic of the service bus.
Log example
This is the gecholog
log structure
{
"egress_post_timer": {
"start": "2023-11-09T15:06:24.660573919Z",
"stop": "2023-11-09T15:06:24.685551051Z",
"duration": 24
},
"ingress_egress_timer": {
"start": "2023-11-09T15:06:23.504801033Z",
"stop": "2023-11-09T15:06:24.660573919Z",
"duration": 1155
},
"request": {
"gl_path": "/service/capped/",
"ingress_headers": {
"Accept": [
"*/*"
],
"Api-Key": [
"*****MASKED*****"
],
"Content-Length": [
"266"
],
"Content-Type": [
"application/json"
],
"User-Agent": [
"curl/8.1.2"
]
},
"ingress_outbound_timer": {
"start": "2023-11-09T15:06:23.504801033Z",
"stop": "2023-11-09T15:06:23.5064882Z",
"duration": 1
},
"ingress_payload": {
"messages": [
{
"role": "system",
"content": "Assistant is a large language model trained by OpenAI."
},
{
"role": "user",
"content": "Who are the founders of Microsoft?"
}
],
"max_tokens": 15
},
"ingress_query_parameters": [
{
"name": "api-version",
"details": [
"2023-05-15"
]
}
],
"ingress_subpath": "openai/deployments/deployment/chat/completions",
"outbound_headers": {
"Accept": [
"*/*"
],
"Api-Key": [
"*****MASKED*****"
],
"User-Agent": [
"curl/8.1.2"
]
},
"outbound_payload": {
"messages": [
{
"role": "system",
"content": "Assistant is a large language model trained by OpenAI."
},
{
"role": "user",
"content": "Who are the founders of Microsoft?"
}
],
"max_tokens": 15
},
"outbound_query_parameters": [
{
"name": "api-version",
"details": [
"2023-05-15"
]
}
],
"outbound_subpath": "openai/deployments/deployment/chat/completions",
"processors": [
{
"name": "token_counter",
"details": {
"required": false,
"completed": true,
"timestamp": {
"start": "2023-11-09T15:06:23.504993427Z",
"stop": "2023-11-09T15:06:23.506338121Z",
"duration": 1
}
}
}
],
"processors_async": [
{
"name": "spacy_entities",
"details": {
"required": false,
"completed": true,
"timestamp": {
"start": "2023-11-09T15:06:24.66078701Z",
"stop": "2023-11-09T15:06:24.673035477Z",
"duration": 12
}
}
}
],
"spacy_entities": { // <- Custom Field from Processor
"entities": [
{
"text": "Microsoft",
"label": "ORG"
}
]
},
"url_path": "https://your-openai.openai.azure.com/openai/deployments/deployment/chat/completions?api-version=2023-05-15"
},
"response": {
"egress_headers": {
"Access-Control-Allow-Origin": [
"*"
],
"Apim-Request-Id": [
"44eb5dac-2fee-474f-a3ea-fb14dce2a95e"
],
"Cache-Control": [
"no-cache, must-revalidate"
],
"Content-Type": [
"application/json"
],
"Date": [
"Thu, 09 Nov 2023 15:06:24 GMT"
],
"Session-Id": [
"TST00001_1699542383504801033_2_0"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains; preload"
],
"X-Accel-Buffering": [
"no"
],
"X-Content-Type-Options": [
"nosniff"
],
"X-Ms-Client-Request-Id": [
"44eb5dac-2fee-474f-a3ea-fb14dce2a95e"
],
"X-Ms-Region": [
"South Central US"
],
"X-Request-Id": [
"206de54a-e4ac-4038-9bc3-d18ee7b50bbc"
]
},
"egress_payload": {
"id": "chatcmpl-8J0trO0vc5qp7NZbzxRVIWZ3RwzLt",
"object": "chat.completion",
"created": 1699542383,
"model": "gpt-4",
"choices": [
{
"index": 0,
"finish_reason": "length",
"message": {
"role": "assistant",
"content": "Microsoft was founded by Bill Gates and Paul Allen on April 4, "
}
}
],
"usage": {
"prompt_tokens": 29,
"completion_tokens": 15,
"total_tokens": 44
}
},
"egress_status_code": 200,
"gl_path": "/service/capped/",
"inbound_egress_timer": {
"start": "2023-11-09T15:06:24.658773134Z",
"stop": "2023-11-09T15:06:24.660573919Z",
"duration": 1
},
"inbound_headers": {
"Access-Control-Allow-Origin": [
"*"
],
"Apim-Request-Id": [
"44eb5dac-2fee-474f-a3ea-fb14dce2a95e"
],
"Cache-Control": [
"no-cache, must-revalidate"
],
"Content-Type": [
"application/json"
],
"Date": [
"Thu, 09 Nov 2023 15:06:24 GMT"
],
"Strict-Transport-Security": [
"max-age=31536000; includeSubDomains; preload"
],
"X-Accel-Buffering": [
"no"
],
"X-Content-Type-Options": [
"nosniff"
],
"X-Ms-Client-Request-Id": [
"44eb5dac-2fee-474f-a3ea-fb14dce2a95e"
],
"X-Ms-Region": [
"South Central US"
],
"X-Request-Id": [
"206de54a-e4ac-4038-9bc3-d18ee7b50bbc"
]
},
"inbound_payload": {
"id": "chatcmpl-8J0trO0vc5qp7NZbzxRVIWZ3RwzLt",
"object": "chat.completion",
"created": 1699542383,
"model": "gpt-4",
"choices": [
{
"index": 0,
"finish_reason": "length",
"message": {
"role": "assistant",
"content": "Microsoft was founded by Bill Gates and Paul Allen on April 4, "
}
}
],
"usage": {
"prompt_tokens": 29,
"completion_tokens": 15,
"total_tokens": 44
}
},
"inbound_status_code": 200,
"outbound_inbound_timer": {
"start": "2023-11-09T15:06:23.5064882Z",
"stop": "2023-11-09T15:06:24.658773134Z",
"duration": 1152
},
"processors": [
{
"name": "token_counter",
"details": {
"required": false,
"completed": true,
"timestamp": {
"start": "2023-11-09T15:06:24.658837625Z",
"stop": "2023-11-09T15:06:24.660302334Z",
"duration": 1
}
}
}
],
"processors_async": [
{
"name": "spacy_entities",
"details": {
"required": false,
"completed": true,
"timestamp": {
"start": "2023-11-09T15:06:24.673179288Z",
"stop": "2023-11-09T15:06:24.685181265Z",
"duration": 12
}
}
}
],
"spacy_entities": { // <- Custom Field from Processor
"entities": [
{
"text": "Microsoft",
"label": "ORG"
},
{
"text": "Bill Gates",
"label": "PERSON"
},
{
"text": "Paul Allen",
"label": "PERSON"
},
{
"text": "April 4",
"label": "DATE"
}
]
},
"token_count": { // <- Custom Field from Processor
"prompt_tokens": 29,
"completion_tokens": 15,
"total_tokens": 44
}
},
"session_id": "TST00001_1699542383504801033_234_0",
"transaction_id": "TST00001_1699542383504801033_234_1"
}
Root level
Field | Description |
---|---|
ingress_egress_timer | Timer object for request-response |
egress_post_timer | Timer object for post-processing |
request | The request object |
response | The request object |
error | Optional if errors on root level |
session_id | Session-ID |
transaction_id | Transaction-ID |
For more information on session_id
and transaction_id
see Section Session ID.
Timer objects
There are several timer objects in the log. The timer objects measure the the time between different timestamps in the gecholog Flow Order.
Field | Value | Description |
---|---|---|
start | 2023-11-09T15:06:24.660573919Z |
Start time |
stop | 2023-11-09T15:06:24.685551051Z |
Stop time |
duration | 24 |
Duration in milliseconds. |
Request
Field | Description |
---|---|
error | Optional field with err during request |
gl_path | The gecholog router path for the request. |
ingress_headers | Headers received on ingress. |
ingress_outbound_timer | Request timer |
ingress_payload | Payload received on ingress. |
ingress_query_parameters | Query parameters on ingress. |
ingress_subpath | Subpath for the ingress. |
outbound_headers | Headers sent on outbound |
outbound_payload | Payload sent on outbound. |
outbound_query_parameters | Query parameters for the outbound request. |
outbound_subpath | Subpath for the outbound request. |
processors | Details about the sync processors used. |
processors_async | Details about the asynchronous processors. |
control | Optional field to block outbound traffic |
url_path | Full URL path used for the request. |
Custom Fields
This is an example on how a processor can add a field to augment the log (async to the request)
{
"spacy_entities": { // <- Custom Field from Processor
"entities": [
{
"text": "Microsoft",
"label": "ORG"
}
]
},
}
Field | Description |
---|---|
spacy_entities | Extracted entities from the spacy nlp-processor. |
Response
Field | Description |
---|---|
egress_headers | Headers sent on egress. |
egress_payload | Payload sent on egress. |
egress_status_code | HTTP status code for the egress response. |
error | Optional field with err during response |
gl_path | the gecholog router path for the request. |
inbound_egress_timer | Response timer |
inbound_headers | Headers received on inbound response. |
inbound_payload | Payload received on inbound. |
inbound_status_code | HTTP status code for the inbound response. |
outbound_inbound_timer | Target response timer |
processors | Details about the processors used in the response. |
processors_async | Details about the sync processors used. |
Custom Fields
This is an example on how a response processor can add a field to augment the log
{
"token_count": { // <- Custom Field from Processor
"prompt_tokens": 29,
"completion_tokens": 15,
"total_tokens": 44
}
}
Field | Description |
---|---|
token_count | Token counts from the tokencounter processor. |
Processors
processor
and processor_async
fields are unsorted arrays of processors that gecholog
has succeeded or tried to execute.
Example of record
{
"name": "token_counter",
"details": {
"required": false,
"completed": true,
"timestamp": {
"start": "2023-11-09T15:06:24.658837625Z",
"stop": "2023-11-09T15:06:24.660302334Z",
"duration": 1
}
}
}
Field | Description |
---|---|
name | The name of the processor, e.g., token_counter . |
required | Indicates if the processor is mandatory (false in this case). |
completed | Status of the processor's execution (true means completed). |
timestamp | Timer object for the processor |
completed=true
means gecholog
got a non-empty object of the right structure back in time from the processor . It does not mean gecholog
accepted to include the response in the log nor that the processor actually did what it should.
Headers
Headers are stored in this structure (example)
{
"ingress_headers": {
"Accept": [
"*/*"
],
"Api-Key": [
"*****MASKED*****"
],
"Content-Length": [
"266"
],
"Content-Type": [
"application/json"
],
"User-Agent": [
"curl/8.1.2"
]
},
}
Headers are stored in the format header
to [value1, value2, ...]
. Headers included in the masked_headers
group are obfuscated in the logs. For additional details on header processing, refer to Section Headers.