Ejemplo n.º 1
0
 def doc_id(self):
     if '__doc_id_suffix' in self.__logdata_dict:
         # this field is added by sf_ script
         temp = self.__logdata_dict['__doc_id_suffix']
         del self.__logdata_dict['__doc_id_suffix']
         return '{0}_{1}'.format(self.__logdata_dict['@id'], temp)
     if self.logconfig['doc_id_suffix']:
         suffix = utils.value_from_nesteddict_by_dottedkey(
             self.__logdata_dict, self.logconfig['doc_id_suffix'])
         if suffix:
             return '{0}_{1}'.format(self.__logdata_dict['@id'], suffix)
     return self.__logdata_dict['@id']
Ejemplo n.º 2
0
 def clean_multi_type_field(self):
     clean_multi_type_dict = {}
     multifield_keys = self.logconfig['json_to_text'].split()
     for multifield_key in multifield_keys:
         v = utils.value_from_nesteddict_by_dottedkey(
             self.__logdata_dict, multifield_key)
         if v:
             # json obj in json obj
             if isinstance(v, int):
                 new_dict = utils.put_value_into_nesteddict(
                     multifield_key, v)
             elif '{' in v:
                 new_dict = utils.put_value_into_nesteddict(
                     multifield_key, repr(v))
             else:
                 new_dict = utils.put_value_into_nesteddict(
                     multifield_key, str(v))
             clean_multi_type_dict = utils.merge_dicts(
                 clean_multi_type_dict, new_dict)
     self.__logdata_dict = utils.merge_dicts(self.__logdata_dict,
                                             clean_multi_type_dict)