Skip to content

SumoLogic

ApiEnabledAudit

Class: Drutiny\SumoLogic\Audit\ApiEnabledAudit
Extends: Drutiny\Audit
Package: drutiny/sumologic

NOTE: This Audit is abstract and cannot be used directly by a policy.

Parameters

Name Type Description Default
from string The reporting date to start from. e.g. -24 hours. false
to string The reporting date to end on. e.g. now. false
timeZone string The timeZone the dates refer to. false

Tokens

Name Type Description Default
from string The reporting date to start from. e.g. -24 hours. false
to string The reporting date to end on. e.g. now. false
timeZone string The timeZone the dates refer to. false

NoLogsFound

Class: Drutiny\SumoLogic\Audit\NoLogsFound
Extends: Drutiny\SumoLogic\Audit\ApiEnabledAudit
Package: drutiny/sumologic

Source
  public function audit(Sandbox $sandbox)
  {
    list($sitegroup, $env) = explode('.', str_replace('@', '', $sandbox->drush()->getAlias()), 2);
    $tokens['@sitegroup'] = $sitegroup;
    $tokens['@environment'] = $env;

    $query = $sandbox->getParameter('query');

    $query = strtr($query, $tokens);

    $records = $this->search($sandbox, $query);

    if ($globals = $sandbox->getParameter('globals', []) && $row = reset($records)) {
      foreach ($globals as $key) {
        $sandbox->setParameter($key, $row[$key]);
      }
    }

    $sandbox->setParameter('count', count($records));

    return count($records) === 0;
  }

Query

Class: Drutiny\SumoLogic\Audit\Query
Extends: Drutiny\SumoLogic\Audit\ApiEnabledAudit
Package: drutiny/sumologic

Source
  public function audit(Sandbox $sandbox)
  {
    list($sitegroup, $env) = explode('.', str_replace('@', '', $sandbox->drush()->getAlias()), 2);
    $tokens['@sitegroup'] = $sitegroup;
    $tokens['@environment'] = $env;

    $query = $sandbox->getParameter('query');

    $query = strtr($query, $tokens);

    $records = $this->search($sandbox, $query);

    if (($globals = $sandbox->getParameter('globals', [])) && $row = reset($records)) {
      foreach ($globals as $key) {
        $sandbox->setParameter($key, $row[$key]);
      }
    }

    return count($records) === 0 ? self::NOT_APPLICABLE : self::NOTICE;
  }