← Back to team overview

yahoo-eng-team team mailing list archive

[Bug 1468723] [NEW] Resource uuid is not logged when a resource is created

 

Public bug reported:

In the case of Nova, instance uuid is output to log when new instance is created.
The following logs are part of "nova boot" result.
2015-06-25 11:15:16.637 DEBUG nova.compute.api [req-5f2782c8-1bb7-4735-a714-e720833f4a6d admin admin] Going to run 1 instances... from (pid=3336) _provision_instances /opt/stack/nova/nova/compute/api.py:929
2015-06-25 11:15:16.756 DEBUG nova.compute.api [req-5f2782c8-1bb7-4735-a714-e720833f4a6d admin admin] [instance: e7dd5627-0b72-48e9-bcc1-0e49f267dcec] block_device_mapping BlockDeviceMappingList(objects=[BlockDeviceMapping(UNKNOWN)]) from (pid=3336) _create_block_device_mapping /opt/stack/nova/nova/compute/api.py:1200

But, in the case of Neutron or other component, uuid is not output to log when new resource is created.
If error occurs in that resource, user cannot determine about followings.
 *When the resource is created?
 *Who the resources created?
That is not useful in all project and inconsistent between projects.

By adding "resource" argument to logging, new resource uuid is output to
log.

Because the log output mechanism has been already implemented in oslo.log[1], this patch just adds "resource" information to log.
In addition, existing processing is not affected unless "resource" is specified in logging_context_format_string.

Followings are sample executed "neutron net-create".

  *configure file
    logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_id)s%(color)s] %(resource)s%(color)s%(message)s

  *souruce file
    rscdict = {'type': 'network', 'id': '8e6a748c-aa8a-440b-904a-a6e2f6dc00eb'}
    LOG.info("network create success", resource=rscdict)

  *log file
    INFO neutron.db.db_base_plugin_v2 [req-1667753a-e5f5-4417-bd8d-16f12bcc2e34 admin 0862ba8c3497455a8fdf40c49f0f2644] [network-8e6a748c-aa8a-440b-904a-a6e2f6dc00eb] network create success

[1]
https://review.openstack.org/#/c/144813/

** Affects: neutron
     Importance: Undecided
     Assignee: Daisuke Fujita (fuzita-daisuke)
         Status: New

** Changed in: neutron
     Assignee: (unassigned) => Daisuke Fujita (fuzita-daisuke)

-- 
You received this bug notification because you are a member of Yahoo!
Engineering Team, which is subscribed to neutron.
https://bugs.launchpad.net/bugs/1468723

Title:
  Resource uuid is not logged when a resource is created

Status in OpenStack Neutron (virtual network service):
  New

Bug description:
  In the case of Nova, instance uuid is output to log when new instance is created.
  The following logs are part of "nova boot" result.
  2015-06-25 11:15:16.637 DEBUG nova.compute.api [req-5f2782c8-1bb7-4735-a714-e720833f4a6d admin admin] Going to run 1 instances... from (pid=3336) _provision_instances /opt/stack/nova/nova/compute/api.py:929
  2015-06-25 11:15:16.756 DEBUG nova.compute.api [req-5f2782c8-1bb7-4735-a714-e720833f4a6d admin admin] [instance: e7dd5627-0b72-48e9-bcc1-0e49f267dcec] block_device_mapping BlockDeviceMappingList(objects=[BlockDeviceMapping(UNKNOWN)]) from (pid=3336) _create_block_device_mapping /opt/stack/nova/nova/compute/api.py:1200

  But, in the case of Neutron or other component, uuid is not output to log when new resource is created.
  If error occurs in that resource, user cannot determine about followings.
   *When the resource is created?
   *Who the resources created?
  That is not useful in all project and inconsistent between projects.

  By adding "resource" argument to logging, new resource uuid is output
  to log.

  Because the log output mechanism has been already implemented in oslo.log[1], this patch just adds "resource" information to log.
  In addition, existing processing is not affected unless "resource" is specified in logging_context_format_string.

  Followings are sample executed "neutron net-create".

    *configure file
      logging_context_format_string = %(asctime)s.%(msecs)03d %(color)s%(levelname)s %(name)s [%(request_id)s %(user_name)s %(project_id)s%(color)s] %(resource)s%(color)s%(message)s

    *souruce file
      rscdict = {'type': 'network', 'id': '8e6a748c-aa8a-440b-904a-a6e2f6dc00eb'}
      LOG.info("network create success", resource=rscdict)

    *log file
      INFO neutron.db.db_base_plugin_v2 [req-1667753a-e5f5-4417-bd8d-16f12bcc2e34 admin 0862ba8c3497455a8fdf40c49f0f2644] [network-8e6a748c-aa8a-440b-904a-a6e2f6dc00eb] network create success

  [1]
  https://review.openstack.org/#/c/144813/

To manage notifications about this bug go to:
https://bugs.launchpad.net/neutron/+bug/1468723/+subscriptions


Follow ups

References