diff --git a/openair-cn/COMMON/s1ap_messages_def.h b/openair-cn/COMMON/s1ap_messages_def.h
index d13a5902f48dade7a9aaa60a6b2873708046402b..4ebf6cf79c5117d7dc69ebf4f30e60e9de996ab3 100644
--- a/openair-cn/COMMON/s1ap_messages_def.h
+++ b/openair-cn/COMMON/s1ap_messages_def.h
@@ -1,5 +1,16 @@
 //WARNING: Do not include this header directly. Use intertask_interface.h instead.
 
-MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND,     MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t,           s1ap_ue_cap_ind)
-MESSAGE_DEF(S1AP_ENB_DEREGISTERED_IND,    MESSAGE_PRIORITY_MED, s1ap_eNB_deregistered_ind_t, s1ap_eNB_deregistered_ind)
-MESSAGE_DEF(S1AP_DEREGISTER_UE_REQ,       MESSAGE_PRIORITY_MED, s1ap_deregister_ue_req_t,    s1ap_deregister_ue_req)
+/* Messages for S1AP logging */
+MESSAGE_DEF(S1AP_UPLINK_NAS_LOG            , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_uplink_nas_log)
+MESSAGE_DEF(S1AP_UE_CAPABILITY_IND_LOG     , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_capability_ind_log)
+MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_initial_context_setup_log)
+MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND_LOG  , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_nas_non_delivery_ind_log)
+MESSAGE_DEF(S1AP_DOWNLINK_NAS_LOG          , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_downlink_nas_log)
+MESSAGE_DEF(S1AP_S1_SETUP_LOG              , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_s1_setup_log)
+MESSAGE_DEF(S1AP_INITIAL_UE_MESSAGE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_initial_ue_message_log)
+MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_req_log)
+MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_log)
+
+MESSAGE_DEF(S1AP_UE_CAPABILITIES_IND       , MESSAGE_PRIORITY_MED, s1ap_ue_cap_ind_t                , s1ap_ue_cap_ind)
+MESSAGE_DEF(S1AP_ENB_DEREGISTERED_IND      , MESSAGE_PRIORITY_MED, s1ap_eNB_deregistered_ind_t      , s1ap_eNB_deregistered_ind)
+MESSAGE_DEF(S1AP_DEREGISTER_UE_REQ         , MESSAGE_PRIORITY_MED, s1ap_deregister_ue_req_t         , s1ap_deregister_ue_req)
diff --git a/openair-cn/S1AP/s1ap_eNB_decoder.c b/openair-cn/S1AP/s1ap_eNB_decoder.c
index 5e7c701ea43f1f6a59096f263496f05c26cdf32c..20bb4b67bca20aed9267279e0b8b5afb4b229bcc 100644
--- a/openair-cn/S1AP/s1ap_eNB_decoder.c
+++ b/openair-cn/S1AP/s1ap_eNB_decoder.c
@@ -48,10 +48,11 @@
 static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
     S1ap_InitiatingMessage_t *initiating_p)
 {
-    int ret = -1;
+    int         ret = -1;
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(initiating_p != NULL);
 
@@ -68,12 +69,14 @@ static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
             ret = s1ap_decode_s1ap_downlinknastransporties(
                 &message->msg.s1ap_DownlinkNASTransportIEs, &initiating_p->value);
             s1ap_xer_print_s1ap_downlinknastransport(s1ap_xer__print2sp, message_string, message);
+            message_id = S1AP_DOWNLINK_NAS_LOG;
             break;
 
         case S1ap_ProcedureCode_id_InitialContextSetup:
             ret = s1ap_decode_s1ap_initialcontextsetuprequesties(
                 &message->msg.s1ap_InitialContextSetupRequestIEs, &initiating_p->value);
             s1ap_xer_print_s1ap_initialcontextsetuprequest(s1ap_xer__print2sp, message_string, message);
+            message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
             break;
 
         default:
@@ -84,8 +87,9 @@ static int s1ap_eNB_decode_initiating_message(s1ap_message *message,
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG, message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_downlink_nas_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_downlink_nas_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
@@ -101,6 +105,7 @@ static int s1ap_eNB_decode_successful_outcome(s1ap_message *message,
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(successfullOutcome_p != NULL);
 
@@ -117,6 +122,7 @@ static int s1ap_eNB_decode_successful_outcome(s1ap_message *message,
             ret = s1ap_decode_s1ap_s1setupresponseies(
                 &message->msg.s1ap_S1SetupResponseIEs, &successfullOutcome_p->value);
             s1ap_xer_print_s1ap_s1setupresponse(s1ap_xer__print2sp, message_string, message);
+            message_id = S1AP_S1_SETUP_LOG;
             break;
 
         default:
@@ -127,8 +133,9 @@ static int s1ap_eNB_decode_successful_outcome(s1ap_message *message,
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG, message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
diff --git a/openair-cn/S1AP/s1ap_eNB_encoder.c b/openair-cn/S1AP/s1ap_eNB_encoder.c
index 2b08bc9a747d51c2ca574cf22f2ee32ad902ed34..390ec68f7903a19a92bca9131b623d5fd6f4bd75 100644
--- a/openair-cn/S1AP/s1ap_eNB_encoder.c
+++ b/openair-cn/S1AP/s1ap_eNB_encoder.c
@@ -119,6 +119,7 @@ int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p,
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(s1ap_message_p != NULL);
 
@@ -131,24 +132,28 @@ int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p,
             ret = s1ap_eNB_encode_s1_setup_request(
                 &s1ap_message_p->msg.s1ap_S1SetupRequestIEs, buffer, len);
             s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, s1ap_message_p);
+            message_id = S1AP_S1_SETUP_LOG;
             break;
 
         case S1ap_ProcedureCode_id_uplinkNASTransport:
             ret = s1ap_eNB_encode_uplink_nas_transport(
                 &s1ap_message_p->msg.s1ap_UplinkNASTransportIEs, buffer, len);
             s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string, s1ap_message_p);
+            message_id = S1AP_UPLINK_NAS_LOG;
             break;
 
         case S1ap_ProcedureCode_id_UECapabilityInfoIndication:
             ret = s1ap_eNB_encode_ue_capability_info_indication(
                 &s1ap_message_p->msg.s1ap_UECapabilityInfoIndicationIEs, buffer, len);
             s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp, message_string, s1ap_message_p);
+            message_id = S1AP_UE_CAPABILITY_IND_LOG;
             break;
 
         case S1ap_ProcedureCode_id_initialUEMessage:
             ret = s1ap_eNB_encode_initial_ue_message(
                 &s1ap_message_p->msg.s1ap_InitialUEMessageIEs, buffer, len);
             s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string, s1ap_message_p);
+            message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
             break;
 
         case S1ap_ProcedureCode_id_NASNonDeliveryIndication:
@@ -156,18 +161,21 @@ int s1ap_eNB_encode_initiating(s1ap_message *s1ap_message_p,
                 &s1ap_message_p->msg.s1ap_NASNonDeliveryIndication_IEs, buffer, len);
             s1ap_xer_print_s1ap_nasnondeliveryindication_(s1ap_xer__print2sp,
                                                           message_string, s1ap_message_p);
+            message_id = S1AP_NAS_NON_DELIVERY_IND_LOG;
             break;
 
         default:
             S1AP_DEBUG("Unknown procedure ID (%d) for initiating message\n",
                        (int)s1ap_message_p->procedureCode);
+            return ret;
             break;
     }
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG, message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_s1_setup_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_s1_setup_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
@@ -184,6 +192,7 @@ int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(s1ap_message_p != NULL);
 
@@ -196,17 +205,21 @@ int s1ap_eNB_encode_successfull_outcome(s1ap_message *s1ap_message_p,
             ret = s1ap_eNB_encode_initial_context_setup_response(
                 &s1ap_message_p->msg.s1ap_InitialContextSetupResponseIEs, buffer, len);
             s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp, message_string, s1ap_message_p);
+            message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
             break;
+
         default:
             S1AP_DEBUG("Unknown procedure ID (%d) for successfull outcome message\n",
                        (int)s1ap_message_p->procedureCode);
+            return ret;
             break;
     }
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG, message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
@@ -223,6 +236,7 @@ int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *s1ap_message_p,
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(s1ap_message_p != NULL);
 
@@ -235,16 +249,20 @@ int s1ap_eNB_encode_unsuccessfull_outcome(s1ap_message *s1ap_message_p,
 //             ret = s1ap_encode_s1ap_initialcontextsetupfailureies(
 //                 &s1ap_message_p->ittiMsg.s1ap_InitialContextSetupFailureIEs, buffer, len);
             s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp, message_string, s1ap_message_p);
+            message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
             break;
+
         default:
             S1AP_DEBUG("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
                        (int)s1ap_message_p->procedureCode);
+            return ret;
             break;
     }
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG, message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
diff --git a/openair-cn/S1AP/s1ap_mme_decoder.c b/openair-cn/S1AP/s1ap_mme_decoder.c
index 4f77763f893d96430cb447edfd67c998ef86e4f7..0359f4f60c8398826aea7e437b463db5bc9cbf88 100644
--- a/openair-cn/S1AP/s1ap_mme_decoder.c
+++ b/openair-cn/S1AP/s1ap_mme_decoder.c
@@ -58,6 +58,7 @@ static int s1ap_mme_decode_initiating(
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(initiating_p != NULL);
 
@@ -73,6 +74,7 @@ static int s1ap_mme_decode_initiating(
                       &message->msg.s1ap_UplinkNASTransportIEs, &initiating_p->value);
             s1ap_xer_print_s1ap_uplinknastransport(s1ap_xer__print2sp, message_string,
                                                    message);
+            message_id = S1AP_UPLINK_NAS_LOG;
         }
         break;
 
@@ -80,6 +82,7 @@ static int s1ap_mme_decode_initiating(
             ret = s1ap_decode_s1ap_s1setuprequesties(&message->msg.s1ap_S1SetupRequestIEs,
                     &initiating_p->value);
             s1ap_xer_print_s1ap_s1setuprequest(s1ap_xer__print2sp, message_string, message);
+            message_id = S1AP_S1_SETUP_LOG;
         }
         break;
 
@@ -89,6 +92,7 @@ static int s1ap_mme_decode_initiating(
                       &initiating_p->value);
             s1ap_xer_print_s1ap_initialuemessage(s1ap_xer__print2sp, message_string,
                                                  message);
+            message_id = S1AP_INITIAL_UE_MESSAGE_LOG;
         }
         break;
 
@@ -97,6 +101,7 @@ static int s1ap_mme_decode_initiating(
                       &message->msg.s1ap_UEContextReleaseRequestIEs, &initiating_p->value);
             s1ap_xer_print_s1ap_uecontextreleaserequest(s1ap_xer__print2sp, message_string,
                     message);
+            message_id = S1AP_UE_CONTEXT_RELEASE_REQ_LOG;
         }
         break;
 
@@ -105,6 +110,7 @@ static int s1ap_mme_decode_initiating(
                       &message->msg.s1ap_UECapabilityInfoIndicationIEs, &initiating_p->value);
             s1ap_xer_print_s1ap_uecapabilityinfoindication(s1ap_xer__print2sp,
                     message_string, message);
+            message_id = S1AP_UE_CAPABILITY_IND_LOG;
         }
         break;
 
@@ -117,9 +123,9 @@ static int s1ap_mme_decode_initiating(
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG,
-                message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_uplink_nas_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_uplink_nas_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
@@ -136,6 +142,7 @@ static int s1ap_mme_decode_successfull_outcome(
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(successfullOutcome_p != NULL);
 
@@ -152,15 +159,19 @@ static int s1ap_mme_decode_successfull_outcome(
                       &successfullOutcome_p->value);
             s1ap_xer_print_s1ap_initialcontextsetupresponse(s1ap_xer__print2sp,
                     message_string, message);
+            message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
         }
         break;
+
         case S1ap_ProcedureCode_id_UEContextRelease: {
             ret = s1ap_decode_s1ap_uecontextreleasecompleteies(
                       &message->msg.s1ap_UEContextReleaseCompleteIEs, &successfullOutcome_p->value);
             s1ap_xer_print_s1ap_uecontextreleasecomplete(s1ap_xer__print2sp,
                     message_string, message);
+            message_id = S1AP_UE_CONTEXT_RELEASE_LOG;
         }
         break;
+
         default: {
             S1AP_ERROR("Unknown procedure ID (%ld) for successfull outcome message\n",
                        successfullOutcome_p->procedureCode);
@@ -170,9 +181,9 @@ static int s1ap_mme_decode_successfull_outcome(
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG,
-                message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
@@ -189,6 +200,7 @@ static int s1ap_mme_decode_unsuccessfull_outcome(
     MessageDef *message_p;
     char       *message_string = NULL;
     size_t      message_string_size;
+    MessagesIds message_id;
 
     DevAssert(unSuccessfulOutcome_p != NULL);
 
@@ -204,8 +216,10 @@ static int s1ap_mme_decode_unsuccessfull_outcome(
                       &message->msg.s1ap_InitialContextSetupFailureIEs, &unSuccessfulOutcome_p->value);
             s1ap_xer_print_s1ap_initialcontextsetupfailure(s1ap_xer__print2sp,
                     message_string, message);
+            message_id = S1AP_INITIAL_CONTEXT_SETUP_LOG;
         }
         break;
+
         default: {
             S1AP_ERROR("Unknown procedure ID (%d) for unsuccessfull outcome message\n",
                        (int)unSuccessfulOutcome_p->procedureCode);
@@ -215,9 +229,9 @@ static int s1ap_mme_decode_unsuccessfull_outcome(
 
     message_string_size = strlen(message_string);
 
-    message_p = itti_alloc_new_message_sized(TASK_S1AP, GENERIC_LOG,
-                message_string_size);
-    memcpy(&message_p->ittiMsg.generic_log, message_string, message_string_size);
+    message_p = itti_alloc_new_message_sized(TASK_S1AP, message_id, message_string_size + sizeof (IttiMsgText));
+    message_p->ittiMsg.s1ap_initial_context_setup_log.size = message_string_size;
+    memcpy(&message_p->ittiMsg.s1ap_initial_context_setup_log.text, message_string, message_string_size);
 
     itti_send_msg_to_task(TASK_UNKNOWN, INSTANCE_DEFAULT, message_p);
 
diff --git a/openair2/COMMON/s1ap_messages_def.h b/openair2/COMMON/s1ap_messages_def.h
index 554425aff23b10283d1d9447d718072ec99dca02..b0fc082c1a8afcaa4d65c2b191e21f0f42b2398d 100644
--- a/openair2/COMMON/s1ap_messages_def.h
+++ b/openair2/COMMON/s1ap_messages_def.h
@@ -1,3 +1,14 @@
+/* Messages for S1AP logging */
+MESSAGE_DEF(S1AP_UPLINK_NAS_LOG            , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_uplink_nas_log)
+MESSAGE_DEF(S1AP_UE_CAPABILITY_IND_LOG     , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_capability_ind_log)
+MESSAGE_DEF(S1AP_INITIAL_CONTEXT_SETUP_LOG , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_initial_context_setup_log)
+MESSAGE_DEF(S1AP_NAS_NON_DELIVERY_IND_LOG  , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_nas_non_delivery_ind_log)
+MESSAGE_DEF(S1AP_DOWNLINK_NAS_LOG          , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_downlink_nas_log)
+MESSAGE_DEF(S1AP_S1_SETUP_LOG              , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_s1_setup_log)
+MESSAGE_DEF(S1AP_INITIAL_UE_MESSAGE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_initial_ue_message_log)
+MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_REQ_LOG, MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_req_log)
+MESSAGE_DEF(S1AP_UE_CONTEXT_RELEASE_LOG    , MESSAGE_PRIORITY_MED, IttiMsgText                      , s1ap_ue_context_release_log)
+
 /* eNB application layer -> S1AP messages */
 MESSAGE_DEF(S1AP_REGISTER_ENB_REQ          , MESSAGE_PRIORITY_MED, s1ap_register_enb_req_t          , s1ap_register_enb_req)