IP // //{ // "COLI_WebCode": "JP", // "COLI_ID": "ZPL161028068", // "COLI_ApplyDate": "2016-04-15 23:17:20", // "COLI_SenderIP": "116.226.169.236" //} // //CHT:http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id=hy161104033 //国际:http://www.viaje-a-china.com/index.php/ajax/ajax_order_datas/ // // $order_id = isset($_GET['order_id']) ? $_GET['order_id'] : FALSE; $order_id = isset($_POST['order_id']) ? $_POST['order_id'] : $order_id; //$site = isset($_GET['site']) ? $_GET['site'] : FALSE; //$site = isset($_POST['site']) ? $_POST['site'] : $site; $ip = '255.255.255.255'; $web_code = FALSE; $date = date('Y-m-d h:i:s'); $host = array( 'xx' => 'xx', 'jp' => 'JP', 'vc' => 'FR', 'vac' => 'ES', 'train_vac' => 'ES', 'ru' => 'RU', 'train_ru' => 'RU', 'it' => 'IT', 'train_it' => 'IT', 'cht' => 'CHT', 'ct' => 'yincheng', 'gm' => 'gm-vps', 'ah' => 'AH', ); $host_name = array( 'jp' => 'http://www.arachina.com', 'vc' => 'http://www.voyageschine.com', 'vac' => 'http://www.viaje-a-china.com', 'train_vac' => 'http://www.viaje-a-china.com', 'ru' => 'http://www.chinahighlights.ru', 'train_ru' => 'http://www.chinahighlights.ru', 'it' => 'http://www.viaggio-in-cina.it', 'train_it' => 'http://www.viaggio-in-cina.it', 'cht' => 'http://www.chinahighlights.com', 'ct' => 'http://www.chinatravel.com', 'gm' => 'http://www.chinarundreisen.com', 'ah' => 'http://www.asiahighlights.com', ); $bf_date = date('m/d/Y:00:00:00', time() - 3600*24*90); $af_date = date('m/d/Y:00:00:00', time() + 3600*24*90); $order_txt = ''; $web_code = 'xx'; $order_date = ''; if ($order_id) { //if ($site == 'ch') //{ // $order = @file_get_contents('http://www.chinahighlights.com/api/api.php?method=order.json_by_lmr&order_id='.$order_id); //} //else //{ $order = @file_get_contents('http://www.viaje-a-china.com/index.php/ajax/ajax_order_datas/'.$order_id); //} if ($order && $order !== 'no data') { $order = json_decode($order); $ip = $order->COLI_SenderIP; if (!$ip || $ip=='159.8.126.74' || $ip=='180.140.114.208') { $ip = null; } $web_code = $order->COLI_WebCode; $order_date = $order->COLI_ApplyDate; $date_time = strtotime($order->COLI_ApplyDate); $bf_date = date('m/d/Y:00:00:00', $date_time - 3600*24*90); $af_date = date('m/d/Y:00:00:00', $date_time + 3600*24*90); $order_txt = $order->COLI_OrderDetailText; } } //连接Splunk SDK require_once '../Splunk.php'; $connect_arguments = array( 'scheme' => 'https', 'host' => '192.155.250.125', 'port' => 8089, 'username' => 'haina', 'password' => '383d43GZ82[Ai', ); $service = new Splunk_Service($connect_arguments); $service->login(); //查询IP //[EXA] host=ES "68.180.229.232" earliest="11/1/2016:00:00:00" latest="11/2/2016:00:00:00" $results = array(); if ($ip) { $search = 'search host='.$host[strtolower($web_code)].' "'.$ip.'" earliest="'.$bf_date.'" latest="'.$af_date.'" NOT("/ngx_pagespeed_beacon" OR "/tourprice" OR "/include" OR "/api" OR "/ajax" OR "/image" OR "/common" OR "/ckplayer" OR ".css" OR ".js" OR ".ico" OR ".gif" OR ".jpg" OR ".png" OR ".json" OR ".xml" OR ".ttf" OR ".woff" OR ".eot" OR "webhtmllog" OR "asphttp_accept_language" OR "down.asp" OR "verifyemail" OR "test")'; //调用Spluck Search $job = $service->getJobs()->create($search); while (!$job->isDone()) { $job->refresh(); } $results = $job->getResults(); } ?> 订单日志查询
getFieldNames(); //所需字段 $need_th = array('_serial', '_raw', '_time'); //字段差集 $columnNames = array_intersect($need_th, $columnNames); echo ''; foreach($columnNames as $columnName) echo ''; echo ''; echo "\n"; } else if ($result instanceof Splunk_ResultsMessage) { $messages[] = $result; } else if (is_array($result)) { $anyRows = TRUE; assert($columnNames !== NULL); echo ''; foreach($columnNames as $columnName) { $cellValue = array_key_exists($columnName, $result) ? $result[$columnName] : NULL; //nginx日志 if ($columnName == '_raw') { echo ''; } //日期 else if ($columnName == '_time') { echo ''; } //splunk记录 else { echo ''; } } echo ''; } } ?>
提示: “GET”表示正常访问;“POST”表示从表单提交访问;“标黄”表示订单相关的访问。
'.htmlspecialchars($columnName). '
'; if (is_array($cellValue)) { $log = implode('', $cellValue); //116.226.169.236 - - [27/Oct/2016:07:35:39 -0500] "GET / HTTP/1.1" 200 8857 "-" "Mozilla/5.0 (iPhone; CPU iPhone OS 10_0_2 like Mac OS X) AppleWebKit/602.1.50 (KHTML, like Gecko) Version/10.0 Mobile/14A456 Safari/602.1" //ip(1), visit(3), from(6), ua(7) $p = '/^(\d{1,3}.\d{1,3}.\d{1,3}.\d{1,3})\s-\s-\s\[(.*)\]\s\"(.*)\"\s(\d{3})\s(\d+)\s\"(.*)\"\s\"(.*)\"$/'; preg_match($p, $log, $matches); //print_r($matches); if (isset($matches[3])) { $tmp_a = explode(' ', $matches[3]); echo 'visit '.urldecode($matches[3]).'  '; } if (isset($matches[6])) { if ($matches[6]=='-') $matches[6] = '从收藏夹、历史记录或地址栏直接访问'; echo 'from '.urldecode($matches[6]).'  '; } if (!isset($matches[1])) { echo $log; } } echo '
'; $time = strtotime($cellValue); echo date('Y-m-d h:i:s', $time); echo ''; if ($cellValue !== NULL) { if (is_array($cellValue)) { echo '
    '; foreach($cellValue as $value) { echo '
  • '.htmlspecialchars($value).'
  • '; } echo '
'; } else { echo htmlspecialchars($cellValue); } } echo '
0): ?>

没有查到相关日志