We earlier introduced a new OpenSAF config object with the name 
opensafConfigId=opensafGlobalConfig,safApp=OpenSAF, containing the 
attribute opensafNetworkName. I think the recommendation is to set this 
attribute to the same value as the domain name of the nodes in the cluster.

regards,
Anders Widell

On 02/20/2017 10:56 AM, A V Mahesh wrote:
> Hi Anders Widell,
>
>
> On 2/20/2017 2:25 PM, Anders Widell wrote:
>> Yes, the HOSTNAME field of the log record should contain the fully 
>> qualified domain name (i.e. the host name followed by the domain 
>> name). See Section 6.2.4 in RFC 5424 where the HOSTNAME field is 
>> described.
>>
>> I agree that it could be confusing if the host name and the node name 
>> differ, but ideally they should not. The host name is what you see in 
>> other situations as well, for example you often put the host name in 
>> the shell prompt that you see when you log in to the node via SSH. I 
>> would anyhow recommend to configure host name and node name with the 
>> same value.
>
> Then Opensaf Should force `domain name` should be same as  Opensaf IMM 
> configured  CLM Name  while starting Opensaf .
>
> -AVM
>
>>
>> regards,
>>
>> Anders Widell
>>
>> On 02/20/2017 07:17 AM, A V Mahesh wrote:
>>> Hi Anders Widell,
>>>
>>> I see an issue with the way the MW Node name presented  in MDS log 
>>> with this patch , I did configured CLM/AMF name
>>> as below ( NON SC_1 & SC-2 )  , but the mds log is considering linux 
>>> name , either we have to use  CLM name or AMF name in MDS log
>>>
>>> =================================================================================================
>>>  
>>>
>>>
>>> # cat /usr/share/opensaf/immxml/nodes.cfg
>>> SC fm1 PL-0
>>> SC fm2 PL-1
>>> PL PL-3 PL-3
>>> PL PL-4 PL-4
>>>
>>> # cat /etc/opensaf/node_name
>>> PL-0
>>>
>>> # cat /etc/opensaf/node_name
>>> PL-1
>>>
>>> #  /etc/init.d/opensafd status
>>> safSISU=safSu=fm1\,safSg=NoRed\,safApp=OpenSAF,safSi=NoRed1,safApp=OpenSAF 
>>>
>>>         saAmfSISUHAState=ACTIVE(1)
>>> safSISU=safSu=fm2\,safSg=NoRed\,safApp=OpenSAF,safSi=NoRed2,safApp=OpenSAF 
>>>
>>>         saAmfSISUHAState=ACTIVE(1)
>>> safSISU=safSu=fm1\,safSg=2N\,safApp=OpenSAF,safSi=SC-2N,safApp=OpenSAF
>>>         saAmfSISUHAState=ACTIVE(1)
>>> safSISU=safSu=fm2\,safSg=2N\,safApp=OpenSAF,safSi=SC-2N,safApp=OpenSAF
>>>         saAmfSISUHAState=STANDBY(2)
>>>
>>>
>>> <141>1 2017-02-20T11:38:14.881123+05:30 SC-1 osafclmna 26474 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>> <141>1 2017-02-20T11:38:14.954587+05:30 SC-1 osafrded 26483 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>> <141>1 2017-02-20T11:38:15.029386+05:30 SC-1 osaffmd 26492 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>> <141>1 2017-02-20T11:38:15.099421+05:30 SC-1 osafimmd 26502 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>>
>>> <141>1 2017-02-20T11:38:30.60291+05:30 SC-2 osafclmna 6196 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>> <141>1 2017-02-20T11:38:30.667317+05:30 SC-2 osafrded 6205 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>> <141>1 2017-02-20T11:38:30.739622+05:30 SC-2 osaffmd 6214 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>> <141>1 2017-02-20T11:38:30.807048+05:30 SC-2 osafimmd 6224 mds.log 
>>> [meta sequenceId="1"] BEGIN MDS LOGGING| ARCHW=a|64bit=1
>>>
>>> =================================================================================================
>>>  
>>>
>>>
>>> -AVM
>>>
>>>
>>> On 2/17/2017 3:03 PM, Anders Widell wrote:
>>>>   src/mds/mds_log.cc |  39 ++++++++++++++++++---------------------
>>>>   1 files changed, 18 insertions(+), 21 deletions(-)
>>>>
>>>>
>>>> The HOSTNAME field of the log messages should contain the FQDN of the
>>>> originator. Use the newly introduced Conf class in the base 
>>>> component to read
>>>> the FQDN.
>>>>
>>>> diff --git a/src/mds/mds_log.cc b/src/mds/mds_log.cc
>>>> --- a/src/mds/mds_log.cc
>>>> +++ b/src/mds/mds_log.cc
>>>> @@ -1,6 +1,7 @@
>>>>   /*      -*- OpenSAF  -*-
>>>>    *
>>>>    * (C) Copyright 2008 The OpenSAF Foundation
>>>> + * Copyright Ericsson AB 2017 - All Rights Reserved.
>>>>    *
>>>>    * This program is distributed in the hope that it will be 
>>>> useful, but
>>>>    * WITHOUT ANY WARRANTY; without even the implied warranty of 
>>>> MERCHANTABILITY
>>>> @@ -32,6 +33,7 @@
>>>>   #include <cstring>
>>>>   #include <string>
>>>>   #include "base/buffer.h"
>>>> +#include "base/conf.h"
>>>>   #include "base/log_message.h"
>>>>   #include "base/macros.h"
>>>>   #include "base/mutex.h"
>>>> @@ -50,17 +52,18 @@ class MdsLog {
>>>>                     va_list ap);
>>>>      private:
>>>> -  MdsLog(const char* host_name, const char* app_name,
>>>> -            uint32_t proc_id, const char* socket_name);
>>>> +  MdsLog(const std::string& fqdn, const char* app_name,
>>>> +         uint32_t proc_id, const char* socket_name);
>>>>     void LogInternal(base::LogMessage::Severity severity, const 
>>>> char *fmt,
>>>>                      va_list ap);
>>>>     static constexpr const uint32_t kMaxSequenceId = 
>>>> uint32_t{0x7fffffff};
>>>>     static MdsLog* instance_;
>>>> -  const base::LogMessage::HostName host_name_;
>>>> +  const base::LogMessage::HostName fqdn_;
>>>>     const base::LogMessage::AppName app_name_;
>>>>     const base::LogMessage::ProcId proc_id_;
>>>>     uint32_t sequence_id_;
>>>>     base::UnixClientSocket log_socket_;
>>>> +  base::Buffer<512> buffer_;
>>>>     base::Mutex mutex_;
>>>>       DELETE_COPY_AND_MOVE_OPERATORS(MdsLog);
>>>> @@ -69,13 +72,14 @@ class MdsLog {
>>>>   int gl_mds_log_level = 3;
>>>>   MdsLog* MdsLog::instance_ = nullptr;
>>>>   -MdsLog::MdsLog(const char* host_name, const char* app_name,
>>>> -                     uint32_t proc_id, const char* socket_name) :
>>>> -    host_name_{base::LogMessage::HostName{host_name}},
>>>> +MdsLog::MdsLog(const std::string& fqdn, const char* app_name,
>>>> +               uint32_t proc_id, const char* socket_name) :
>>>> +    fqdn_{base::LogMessage::HostName{fqdn}},
>>>>       app_name_{base::LogMessage::AppName{app_name}},
>>>> proc_id_{base::LogMessage::ProcId{std::to_string(proc_id)}},
>>>>       sequence_id_{1},
>>>>       log_socket_{socket_name},
>>>> +    buffer_{},
>>>>       mutex_{} {
>>>>   }
>>>>   @@ -86,12 +90,10 @@ MdsLog::MdsLog(const char* host_name, co
>>>>   bool MdsLog::Init() {
>>>>     if (instance_ != nullptr) return false;
>>>>     char app_name[MDS_MAX_PROCESS_NAME_LEN];
>>>> -  char node_name[256];
>>>>     char pid_path[1024];
>>>>     uint32_t process_id = getpid();
>>>>     char *token, *saveptr;
>>>>     char *pid_name = nullptr;
>>>> -  const char *node_name_file = PKGSYSCONFDIR "/node_name";
>>>>       snprintf(pid_path, sizeof(pid_path), "/proc/%" PRIu32 
>>>> "/cmdline", process_id);
>>>>     FILE* f = fopen(pid_path, "r");
>>>> @@ -114,14 +116,9 @@ bool MdsLog::Init() {
>>>>     if (snprintf(app_name, sizeof(app_name), "%s", pid_name) < 0) {
>>>>       app_name[0] = '\0';
>>>>     }
>>>> -  FILE* fp = fopen(node_name_file, "r");
>>>> -  if (fp != nullptr) {
>>>> -    if (fscanf(fp, "%255s", node_name) != 1) node_name[0] = '\0';
>>>> -    fclose(fp);
>>>> -  } else {
>>>> -    node_name[0] = '\0';
>>>> -  }
>>>> -  instance_ = new MdsLog{node_name, app_name, process_id,
>>>> +  base::Conf::InitFullyQualifiedDomainName();
>>>> +  const std::string& fqdn = base::Conf::FullyQualifiedDomainName();
>>>> +  instance_ = new MdsLog{fqdn, app_name, process_id,
>>>>                            PKGLOCALSTATEDIR "/mds_log.sock"};
>>>>     return instance_ != nullptr;
>>>>   }
>>>> @@ -136,22 +133,22 @@ void MdsLog::LogInternal(base::LogMessag
>>>>     base::Lock lock(mutex_);
>>>>     uint32_t id = sequence_id_;
>>>>     sequence_id_ = id < kMaxSequenceId ? id + 1 : 1;
>>>> -  base::Buffer<256> buffer;
>>>> +  buffer_.clear();
>>>> base::LogMessage::Write(base::LogMessage::Facility::kLocal1,
>>>>                             severity,
>>>>                             base::ReadRealtimeClock(),
>>>> -                          host_name_,
>>>> +                          fqdn_,
>>>>                             app_name_,
>>>>                             proc_id_,
>>>> -                          base::LogMessage::MsgId{""},
>>>> + base::LogMessage::MsgId{"mds.log"},
>>>> {{base::LogMessage::SdName{"meta"},
>>>> {base::LogMessage::Parameter{
>>>> base::LogMessage::SdName{"sequenceId"},
>>>> std::to_string(id)}}}},
>>>>                             fmt,
>>>>                             ap,
>>>> -                          &buffer);
>>>> -  log_socket_.Send(buffer.data(), buffer.size());
>>>> +                          &buffer_);
>>>> +  log_socket_.Send(buffer_.data(), buffer_.size());
>>>>   }
>>>> /*******************************************************************************
>>>>  
>>>>
>>>
>>
>


------------------------------------------------------------------------------
Check out the vibrant tech community on one of the world's most
engaging tech sites, SlashDot.org! http://sdm.link/slashdot
_______________________________________________
Opensaf-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/opensaf-devel

Reply via email to