コード例 #1
0
ファイル: json.c プロジェクト: 0-T-0/goaccess
/* Output the number of static files (jpg, pdf, etc) under the overall
 * object.
 *
 * On success, data is outputted. */
static void
poverall_static_files (FILE * fp, int isp)
{
  int total = ht_get_size_datamap (REQUESTS_STATIC);
  pjson (fp, "%.*s\"%s\": %d,%.*s", isp, TAB, OVERALL_STATIC, total, nlines,
         NL);
}
コード例 #2
0
ファイル: json.c プロジェクト: 0-T-0/goaccess
/* Output the number of not found (404s) under the overall object.
 *
 * On success, data is outputted. */
static void
poverall_notfound (FILE * fp, int isp)
{
  int total = ht_get_size_datamap (NOT_FOUND);
  pjson (fp, "%.*s\"%s\": %d,%.*s", isp, TAB, OVERALL_NOTFOUND, total, nlines,
         NL);
}
コード例 #3
0
ファイル: csv.c プロジェクト: 0-T-0/goaccess
/* Output general statistics information. */
static void
print_csv_summary (FILE * fp, GLog * logger)
{
  long long t = 0LL;
  int i = 0, total = 0;
  off_t log_size = 0;
  char now[DATE_TIME];
  const char *fmt;

  generate_time ();
  strftime (now, DATE_TIME, "%Y-%m-%d %H:%M:%S", now_tm);

  /* generated date time */
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%s\",\"%s\"\r\n";
  fprintf (fp, fmt, i++, GENER_ID, now, OVERALL_DATETIME);

  /* total requests */
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%d\",\"%s\"\r\n";
  total = logger->processed;
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_REQ);

  /* valid requests */
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%d\",\"%s\"\r\n";
  total = logger->valid;
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_VALID);

  /* invalid requests */
  total = logger->invalid;
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_FAILED);

  /* generated time */
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%llu\",\"%s\"\r\n";
  t = (long long) end_proc - start_proc;
  fprintf (fp, fmt, i++, GENER_ID, t, OVERALL_GENTIME);

  /* visitors */
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%d\",\"%s\"\r\n";
  total = ht_get_size_uniqmap (VISITORS);
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_VISITORS);

  /* files */
  total = ht_get_size_datamap (REQUESTS);
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_FILES);

  /* excluded hits */
  total = logger->excluded_ip;
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_EXCL_HITS);

  /* referrers */
  total = ht_get_size_datamap (REFERRERS);
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_REF);

  /* not found */
  total = ht_get_size_datamap (NOT_FOUND);
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_NOTFOUND);

  /* static files */
  total = ht_get_size_datamap (REQUESTS_STATIC);
  fprintf (fp, fmt, i++, GENER_ID, total, OVERALL_STATIC);

  /* log size */
  if (!logger->piping && conf.ifile)
    log_size = file_size (conf.ifile);
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%jd\",\"%s\"\r\n";
  fprintf (fp, fmt, i++, GENER_ID, (intmax_t) log_size, OVERALL_LOGSIZE);

  /* bandwidth */
  fmt = "\"%d\",,\"%s\",,,,,,,,\"%lld\",\"%s\"\r\n";
  fprintf (fp, fmt, i++, GENER_ID, logger->resp_size, OVERALL_BANDWIDTH);

  /* log path */
  if (conf.ifile == NULL)
    conf.ifile = (char *) "STDIN";

  fmt = "\"%d\",,\"%s\",,,,,,,,\"%s\",\"%s\"\r\n";
  fprintf (fp, fmt, i++, GENER_ID, conf.ifile, OVERALL_LOG);
}
コード例 #4
0
ファイル: ui.c プロジェクト: charpty/goaccess
/* Convert the number of static requests to a string.
 *
 * On success, the number of static requests as a string is returned. */
static char *
get_str_static_reqs (void)
{
  return int2str (ht_get_size_datamap (REQUESTS_STATIC), 0);
}
コード例 #5
0
ファイル: ui.c プロジェクト: charpty/goaccess
/* Convert the number of referrers to a string.
 *
 * On success, the number of referrers as a string is returned. */
static char *
get_str_ref_reqs (void)
{
  return int2str (ht_get_size_datamap (REFERRERS), 0);
}
コード例 #6
0
ファイル: ui.c プロジェクト: charpty/goaccess
/* Convert the number of not found requests to a string.
 *
 * On success, the number of not found requests as a string is
 * returned. */
static char *
get_str_notfound_reqs (void)
{
  return int2str (ht_get_size_datamap (NOT_FOUND), 0);
}
コード例 #7
0
ファイル: json.c プロジェクト: aishikoyo/goaccess
/* Write to a buffer the number of static files (jpg, pdf, etc) under
 * the overall object. */
static void
poverall_static_files (GJSON * json, int sp)
{
  pskeyival (json, OVERALL_STATIC, ht_get_size_datamap (REQUESTS_STATIC), sp,
             0);
}
コード例 #8
0
ファイル: json.c プロジェクト: aishikoyo/goaccess
/* Write to a buffer the number of not found (404s) under the overall
 * object. */
static void
poverall_notfound (GJSON * json, int sp)
{
  pskeyival (json, OVERALL_NOTFOUND, ht_get_size_datamap (NOT_FOUND), sp, 0);
}
コード例 #9
0
ファイル: json.c プロジェクト: aishikoyo/goaccess
/* Write to a buffer the number of referrers under the overall object. */
static void
poverall_refs (GJSON * json, int sp)
{
  pskeyival (json, OVERALL_REF, ht_get_size_datamap (REFERRERS), sp, 0);
}
コード例 #10
0
ファイル: json.c プロジェクト: aishikoyo/goaccess
/* Write to a buffer the total number of unique files under the
 * overall object. */
static void
poverall_files (GJSON * json, int sp)
{
  pskeyival (json, OVERALL_FILES, ht_get_size_datamap (REQUESTS), sp, 0);
}
コード例 #11
0
ファイル: json.c プロジェクト: 0-T-0/goaccess
/* Output the number of referrers under the overall object.
 *
 * On success, data is outputted. */
static void
poverall_refs (FILE * fp, int isp)
{
  int total = ht_get_size_datamap (REFERRERS);
  pjson (fp, "%.*s\"%s\": %d,%.*s", isp, TAB, OVERALL_REF, total, nlines, NL);
}