2 Logs
This chapter explains the process to retrieve the logs and status that can be used for effective troubleshooting.
2.1 Log Levels
Logs register system events along with their date and time of occurrence. They also provide important details about a chain of events that could have led to an error or problem.
A log level helps in defining the severity level of a log message. For UDR, the log level of a microservice can be set to any one of the following valid values:
- TRACE: A log level that describes events, as a step by step execution of code. This can be ignored during the standard operation, but may be useful during extended debugging sessions.
- DEBUG: A log level used for events during software debugging when more granular information is needed.
- INFO: A standard log level indicating that something has happened. For example an application has entered a certain state.
- WARN: A log level indicates that something unexpected has happened in the application, a problem, or a situation that might disturb one of the processes. But this does not mean that the application has failed. The WARN level should be used in situations that are unexpected, but the code can continue to work.
- ERROR: A log level that should be used when an application hits an issue preventing one or more functionalities from functioning.
Using this information, the logs can be filtered based on the system requirements. For instance, if you want to filter the critical information about your system from the informational log messages, set a filter to view messages with only WARN log level in Kibana.
2.2 Log Attribute Details
Table 2-1 Log Attribute Details
| Log Attribute | Details | Example Value | Data Type | Source |
|---|---|---|---|---|
| thread | Thread Name Internal by Spring boot | XNIO-1 task-1 | String | log4j |
| level | Log Level of the log printed | WARN | String | log4j |
| loggerName | Class which printed the log | ocudr.udr.services.service.DbHandler | String | log4j |
| message | Outputs the application supplied message | Subscriber does not exist | String | Application |
| endOfBatch | Log4j2 Internal | false | boolean | log4j |
| loggerFqcn | Log4j2 Internal | org.apache.logging.slf4j.Log4jLogger | String | log4j |
| instant | Epoch time | {"epochSecond":1599703750,"nanoOfSecond":210064000} | Object | log4j |
| threadId | Outputs the ID of the thread that generated the logging event, set internally by Log4j2 | 23 | Integer | log4j |
| threadPriority | Thread Priority set internally by Log4j2 | 5 | Integer | log4j |
| messageTimestamp | Timestamp when log was printed | 21-02-17 07:36:06.343+0000 | String | Application |
| application | NF application name | ocudr | String | Application |
| engVersion | Engineering version of software | 1.10.20 | String | Application |
| mktgVersion | Marketing version of software | 1.10.20.0.0 | String | Application |
| microservice | Microservice name | ocudr-nudr-drservice | String | Application |
| vendor | Vendor name | Oracle | String | Application |
| subscriberId | SubscriberId for which request received | msisdn-1111111113 | String | Application |
| resourceId | Request Uri | nudr-group-id-map/v1/nf-group-ids | String | Application |
| resultCode | Response statusCode | 404 | String | Application |
| ocLogId | Inter NF logId for tracing | 1613547369374_225_ocudr-ingressgateway-6f585c76d4-tp622 | String | Application |
| sbiCorrelationHeader | SBI Correlation Header for request received | msisdn-1111111113 | String | Application |
| requestType | request type received | GET | String | Application |
| kubernetes.container_name | Container name generating log | nudr-dr-service | String | fluentd |
| kubernetes.namespace_name | Namespace of service | ocudr | String | fluentd |
| kubernetes.pod_name | Pod name | ocudr-nudr-drservice-7f8c47f5c9-flkmz | String | fluentd |
| kubernetes.container_image | Container image | cne-170-ga-bastion-1:5000/ocudr/nudr_datarepository_service:1.9.50 | String | fluentd |
| kubernetes.container_image_id | Container image ID | cne-170-ga-bastion-1:5000/ocudr/nudr_datarepository_service@sha256:1141f245a3a437f1423496aebf616a6d3315e22ad09904a868bf1b471759b616 | String | fluentd |
| kubernetes.pod_id | POD id | 6dfa91f8-2d0a-4d8c-a339-381ce98264df | String | fluentd |
| kubernetes.host | Worker node name | cne-170-ga-k8s-node-8 | String | fluentd |
| kubernetes.namespace_id | Unique namespace ID assigned by K8 | d932a8ae-54e9-4df1-8e30-e0335f0b1303 | String | fluentd |
| labels | All the labels on pod that generate the logs |
"labels": { "pod-template-hash": "7f8c47f5c9", "app_kubernetes_io/instance": "ocudr", "app_kubernetes_io/managed-by": "Tiller", "app_kubernetes_io/name": "nudr-drservice", "app_kubernetes_io/part-of": "ocudr", "app_kubernetes_io/version": "1.6.0.0.0", "helm_sh/chart": "nudr-drservice-1.9.50", "io_kompose_service": "nudr-drservice" } |
object | fluentd |
| originHost | Diameter client fqdn | diamcli1.oracle.com | String |
Application Note: Only in diameterproxy and diameter-gateway |
| originRealm | Diameter client realm | oracle.com | String |
Application Note: Only in diameter-gateway |
| serviceIndications | Diameter service indications for GET operations | "serviceIndications" : [ "CamiantUserData", "CamiantStateData"] | Array |
Application Note: Only in diameterproxy |
{"instant":{"epochSecond":1613547366,"nanoOfSecond":343417698},"thread":"XNIO-1 task-1","level":"WARN","loggerName":"ocudr.udr.services.service.DbHandler","message":"Subscriber does not exist","endOfBatch":false,"loggerFqcn":"org.apache.logging.slf4j.Log4jLogger","threadId":46,"threadPriority":5,"messageTimestamp":"21-02-17 07:36:06.343+0000","application":"ocudr","sbiCorrelationHeader":"msisdn-1111111113","engVersion":"1.10.20","mktgVersion":"1.10.20.0.0","microservice":"ocudr-nudr-drservice","vendor":"Oracle","subscriberId":"msisdn-1111111113","resourceId":"nudr-group-id-map/v1/nf-group-ids","resultCode":"404","ocLogId":"1613547369374_225_ocudr-ingressgateway-6f585c76d4-tp622","requestType":"GET"}
{
"_index": "logstash-2021-02-19",
"_type": "_doc",
"_id": "yyQXuHcBwFjE8wmhickN",
"_version": 1,
"_score": 0,
"_source": {
"stream": "stdout",
"docker": {
"container_id": "b1b78faa1043132f77148f16777e60b1db8ae30e9e6b5c2f5af45248063f7d6a"
},
"kubernetes": {
"container_name": "nudr-drservice",
"namespace_name": "bharathudr1",
"pod_name": "bharathudr1-nudr-drservice-7bd66864c6-fw7cq",
"container_image": "cne-172-bastion-1:5000/ocudr/nudr_datarepository_service:ocLogIdTest1",
"container_image_id": "cne-172-bastion-1:5000/ocudr/nudr_datarepository_service@sha256:24875dad7fd363bcb8ec300b007491b2259796e152446fd3d707b17f62fcd6b4",
"pod_id": "ea92c753-48af-4b31-9356-1ce24f27025e",
"host": "cne-172-k8s-node-10",
"labels": {
"pod-template-hash": "7bd66864c6",
"app_kubernetes_io/instance": "bharathudr1",
"app_kubernetes_io/managed-by": "Helm",
"app_kubernetes_io/name": "nudr-drservice",
"app_kubernetes_io/part-of": "ocudr",
"app_kubernetes_io/version": "1.6.0.0.0",
"helm_sh/chart": "nudr-drservice-1.10.20",
"io_kompose_service": "nudr-drservice"
},
"master_url": "https://10.233.0.1:443/api",
"namespace_id": "260e3d4a-d455-4afc-9cff-9aaf8eba79d1"
},
"instant": {
"epochSecond": 1613701232,
"nanoOfSecond": 431593919
},
"thread": "XNIO-1 task-1",
"level": "WARN",
"loggerName": "ocudr.udr.services.service.DbHandler",
"message": "Subscriber does not exist",
"endOfBatch": false,
"loggerFqcn": "org.apache.logging.slf4j.Log4jLogger",
"threadId": 46,
"threadPriority": 5,
"messageTimestamp": "21-02-19 02:20:32.431+0000",
"application": "bharathudr1",
"engVersion": "1.10.20",
"mktgVersion": "1.6.0.0.0",
"microservice": "bharathudr1-nudr-drservice",
"vendor": "Oracle",
"subscriberId": "imsi-100000002",
"sbiCorrelationHeader": "imsi-100000002",
"resourceId": "nudr-group-id-map-prov/v1/slf-group",
"resultCode": "404",
"ocLogId": "1613701211520_2220_bharathudr1-ingressgateway-7d7659c58b-5k6b2",
"requestType": "GET",
"@timestamp": "2021-02-19T02:20:32.432795705+00:00",
"tag": "kubernetes.var.log.containers.bharathudr1-nudr-drservice-7bd66864c6-fw7cq_bharathudr1_nudr-drservice-b1b78faa1043132f77148f16777e60b1db8ae30e9e6b5c2f5af45248063f7d6a.log"
},
"fields": {
"@timestamp": [
"2021-02-19T02:20:32.432Z"
],
"timestamp": []
},
"highlight": {
"resultCode": [
"@kibana-highlighted-field@404@/kibana-highlighted-field@"
],
"message": [
"@kibana-highlighted-field@Subscriber@/kibana-highlighted-field@ @kibana-highlighted-field@does@/kibana-highlighted-field@ @kibana-highlighted-field@not@/kibana-highlighted-field@ @kibana-highlighted-field@exist@/kibana-highlighted-field@"
],
"kubernetes.namespace_name": [
"@kibana-highlighted-field@bharathudr1@/kibana-highlighted-field@"
]
}
}2.3 Collecting Logs
Log files are used to register system events, together with their date and time of occurrence. They can be valuable tools for troubleshooting. Not only do logs indicate that specific events occurred, but also provide important clues about a chain of events that led to an error or problem.
- Run the following command to get the pod
details:
kubectl -n <namespace_name> get pods - Run the following command to collect the logs from the specific
pods or
containers:
kubectl logs <podname> -n <namespace> -c <containername> - Store the log in a file using the following
command:
kubectl logs <podname> -n <namespace> > <filename> - (Optional) Run the following command for the log stream with file
redirection starting with last 100 lines of
log:
kubectl logs <podname> -n <namespace> -f --tail <number of lines> > <filename>For more information on kubectl commands, see Kubernetes website.
For more information on how to collect the logs, see Oracle Communication Cloud Native Core, Data Collector User Guide.
2.4 Configuring Log Levels
To view logging configurations and update logging levels, use the Logging Level Configuration page under Logging Level in the CNC Console. For more information, see the Log Level Configuration section in the Oracle Communications Cloud Native Core, Unified Data Repository User Guide.
Configuring Migration Tool Log Level Using Custom Value File
- To configure
pre-migration-hook:
# Pre Install Hook configurations. Used for DB Schema Upgrade preInstall: image: name: nudr_pre_migration_hook tag: ${nudr_migration_tool_tag} root: logLevel: WARN ocudr: logLevel: WARN - To configure logging of
migration-tool:
# Logging level logging: level: root: "WARN" ocudr: "WARN"
Note:
The following log level values are supported:- DEBUG
- INFO
- WARN
- ERROR