private String getMappedComponentNameForSearch(String clusterName, String componentName, AmbariManagementController controller) {
    try {
      AmbariMetaInfo metaInfo = controller.getAmbariMetaInfo();
      Cluster cluster = controller.getClusters().getCluster(clusterName);
      String serviceName = controller.findServiceName(cluster, componentName);
      Service service = cluster.getService(serviceName);
      StackId stackId = service.getDesiredStackId();

      final String stackName = stackId.getStackName();
      final String stackVersion = stackId.getStackVersion();

      ComponentInfo componentInfo =
        metaInfo.getComponent(stackName, stackVersion, serviceName, componentName);
      if (componentInfo != null) {
        List<LogDefinition> listOfLogs =
          componentInfo.getLogs();
        // for now, the assumption is that there is only one log file associated with each
        // component in LogSearch, but this may change in the future
        if ((listOfLogs != null) && (!listOfLogs.isEmpty())) {
          LogDefinition definition = listOfLogs.get(0);
          // return the first log id we find
          return definition.getLogId();
        }
      }

    } catch (AmbariException e) {
      LOG.error("Error occurred while attempting to locate the log component name for component = " + componentName, e);
    }

    return null;
  }
Get the relevant cluster's resource ID.

@param clusterName a cluster name
@return a resource ID or <code>null</code> if the cluster is not found
ambari-server/src/main/java/org/apache/ambari/server/controller/logging/LoggingSearchPropertyProvider.java