mirror of
https://github.com/alanorth/cgspace-notes.git
synced 2024-12-19 03:32:19 +01:00
301 lines
9.8 KiB
HTML
301 lines
9.8 KiB
HTML
|
<!DOCTYPE html>
|
||
|
<html lang="en" >
|
||
|
|
||
|
<head>
|
||
|
<meta charset="utf-8">
|
||
|
<meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
|
||
|
|
||
|
<meta property="og:title" content="November, 2019" />
|
||
|
<meta property="og:description" content="2019-11-04
|
||
|
|
||
|
|
||
|
Peter noticed that there were 5.2 million hits on CGSpace in 2019-10 according to the Atmire usage statistics
|
||
|
|
||
|
|
||
|
I looked in the nginx logs and see 4.6 million in the access logs, and 1.2 million in the API logs:
|
||
|
|
||
|
# zcat --force /var/log/nginx/*access.log.*.gz | grep -cE "[0-9]{1,2}/Oct/2019"
|
||
|
4671942
|
||
|
# zcat --force /var/log/nginx/{rest,oai,statistics}.log.*.gz | grep -cE "[0-9]{1,2}/Oct/2019"
|
||
|
1277694
|
||
|
|
||
|
|
||
|
|
||
|
So 4.6 million from XMLUI and another 1.2 million from API requests
|
||
|
|
||
|
Let’s see how many of the REST API requests were for bitstreams (because they are counted in Solr stats):
|
||
|
|
||
|
# zcat --force /var/log/nginx/rest.log.*.gz | grep -c -E "[0-9]{1,2}/Oct/2019"
|
||
|
1183456
|
||
|
# zcat --force /var/log/nginx/rest.log.*.gz | grep -E "[0-9]{1,2}/Oct/2019" | grep -c -E "/rest/bitstreams"
|
||
|
106781
|
||
|
|
||
|
" />
|
||
|
<meta property="og:type" content="article" />
|
||
|
<meta property="og:url" content="https://alanorth.github.io/cgspace-notes/2019-11/" />
|
||
|
<meta property="article:published_time" content="2019-11-04T12:20:30+02:00" />
|
||
|
<meta property="article:modified_time" content="2019-11-04T12:20:30+02:00" />
|
||
|
|
||
|
<meta name="twitter:card" content="summary"/>
|
||
|
<meta name="twitter:title" content="November, 2019"/>
|
||
|
<meta name="twitter:description" content="2019-11-04
|
||
|
|
||
|
|
||
|
Peter noticed that there were 5.2 million hits on CGSpace in 2019-10 according to the Atmire usage statistics
|
||
|
|
||
|
|
||
|
I looked in the nginx logs and see 4.6 million in the access logs, and 1.2 million in the API logs:
|
||
|
|
||
|
# zcat --force /var/log/nginx/*access.log.*.gz | grep -cE "[0-9]{1,2}/Oct/2019"
|
||
|
4671942
|
||
|
# zcat --force /var/log/nginx/{rest,oai,statistics}.log.*.gz | grep -cE "[0-9]{1,2}/Oct/2019"
|
||
|
1277694
|
||
|
|
||
|
|
||
|
|
||
|
So 4.6 million from XMLUI and another 1.2 million from API requests
|
||
|
|
||
|
Let’s see how many of the REST API requests were for bitstreams (because they are counted in Solr stats):
|
||
|
|
||
|
# zcat --force /var/log/nginx/rest.log.*.gz | grep -c -E "[0-9]{1,2}/Oct/2019"
|
||
|
1183456
|
||
|
# zcat --force /var/log/nginx/rest.log.*.gz | grep -E "[0-9]{1,2}/Oct/2019" | grep -c -E "/rest/bitstreams"
|
||
|
106781
|
||
|
|
||
|
"/>
|
||
|
<meta name="generator" content="Hugo 0.59.1" />
|
||
|
|
||
|
|
||
|
|
||
|
<script type="application/ld+json">
|
||
|
{
|
||
|
"@context": "http://schema.org",
|
||
|
"@type": "BlogPosting",
|
||
|
"headline": "November, 2019",
|
||
|
"url": "https:\/\/alanorth.github.io\/cgspace-notes\/2019-11\/",
|
||
|
"wordCount": "385",
|
||
|
"datePublished": "2019-11-04T12:20:30+02:00",
|
||
|
"dateModified": "2019-11-04T12:20:30+02:00",
|
||
|
"author": {
|
||
|
"@type": "Person",
|
||
|
"name": "Alan Orth"
|
||
|
},
|
||
|
"keywords": "Notes"
|
||
|
}
|
||
|
</script>
|
||
|
|
||
|
|
||
|
|
||
|
<link rel="canonical" href="https://alanorth.github.io/cgspace-notes/2019-11/">
|
||
|
|
||
|
<title>November, 2019 | CGSpace Notes</title>
|
||
|
|
||
|
|
||
|
<!-- combined, minified CSS -->
|
||
|
<link href="https://alanorth.github.io/cgspace-notes/css/style.css" rel="stylesheet" integrity="sha384-G5B34w7DFTumWTswxYzTX7NWfbvQEg1HbFFEg6ItN03uTAAoS2qkPS/fu3LhuuSA" crossorigin="anonymous">
|
||
|
|
||
|
|
||
|
<!-- RSS 2.0 feed -->
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</head>
|
||
|
|
||
|
<body>
|
||
|
|
||
|
|
||
|
<div class="blog-masthead">
|
||
|
<div class="container">
|
||
|
<nav class="nav blog-nav">
|
||
|
<a class="nav-link " href="https://alanorth.github.io/cgspace-notes/">Home</a>
|
||
|
</nav>
|
||
|
</div>
|
||
|
</div>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<header class="blog-header">
|
||
|
<div class="container">
|
||
|
<h1 class="blog-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/" rel="home">CGSpace Notes</a></h1>
|
||
|
<p class="lead blog-description" dir="auto">Documenting day-to-day work on the <a href="https://cgspace.cgiar.org">CGSpace</a> repository.</p>
|
||
|
</div>
|
||
|
</header>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<div class="container">
|
||
|
<div class="row">
|
||
|
<div class="col-sm-8 blog-main">
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<article class="blog-post">
|
||
|
<header>
|
||
|
<h2 class="blog-post-title" dir="auto"><a href="https://alanorth.github.io/cgspace-notes/2019-11/">November, 2019</a></h2>
|
||
|
<p class="blog-post-meta"><time datetime="2019-11-04T12:20:30+02:00">Mon Nov 04, 2019</time> by Alan Orth in
|
||
|
<i class="fa fa-folder" aria-hidden="true"></i> <a href="/cgspace-notes/categories/notes" rel="category tag">Notes</a>
|
||
|
|
||
|
|
||
|
</p>
|
||
|
</header>
|
||
|
<h2 id="2019-11-04">2019-11-04</h2>
|
||
|
|
||
|
<ul>
|
||
|
<li><p>Peter noticed that there were 5.2 million hits on CGSpace in 2019-10 according to the Atmire usage statistics</p>
|
||
|
|
||
|
<ul>
|
||
|
<li><p>I looked in the nginx logs and see 4.6 million in the access logs, and 1.2 million in the API logs:</p>
|
||
|
|
||
|
<pre><code># zcat --force /var/log/nginx/*access.log.*.gz | grep -cE "[0-9]{1,2}/Oct/2019"
|
||
|
4671942
|
||
|
# zcat --force /var/log/nginx/{rest,oai,statistics}.log.*.gz | grep -cE "[0-9]{1,2}/Oct/2019"
|
||
|
1277694
|
||
|
</code></pre></li>
|
||
|
</ul></li>
|
||
|
|
||
|
<li><p>So 4.6 million from XMLUI and another 1.2 million from API requests</p></li>
|
||
|
|
||
|
<li><p>Let’s see how many of the REST API requests were for bitstreams (because they are counted in Solr stats):</p>
|
||
|
|
||
|
<pre><code># zcat --force /var/log/nginx/rest.log.*.gz | grep -c -E "[0-9]{1,2}/Oct/2019"
|
||
|
1183456
|
||
|
# zcat --force /var/log/nginx/rest.log.*.gz | grep -E "[0-9]{1,2}/Oct/2019" | grep -c -E "/rest/bitstreams"
|
||
|
106781
|
||
|
</code></pre></li>
|
||
|
</ul>
|
||
|
|
||
|
<ul>
|
||
|
<li><p>The types of requests in the access logs are (by lazily extracting the sixth field in the nginx log)</p>
|
||
|
|
||
|
<pre><code># zcat --force /var/log/nginx/*access.log.*.gz | grep -E "[0-9]{1,2}/Oct/2019" | awk '{print $6}' | sed 's/"//' | sort | uniq -c | sort -n
|
||
|
1 PUT
|
||
|
8 PROPFIND
|
||
|
283 OPTIONS
|
||
|
30102 POST
|
||
|
46581 HEAD
|
||
|
4594967 GET
|
||
|
</code></pre></li>
|
||
|
|
||
|
<li><p>Two very active IPs are 34.224.4.16 and 34.234.204.152, which made over 360,000 requests in October:</p>
|
||
|
|
||
|
<pre><code># zcat --force /var/log/nginx/*access.log.*.gz | grep -E "[0-9]{1,2}/Oct/2019" | grep -c -E '(34\.224\.4\.16|34\.234\.204\.152)'
|
||
|
365288
|
||
|
</code></pre></li>
|
||
|
|
||
|
<li><p>Their user agent is one I’ve never seen before:</p>
|
||
|
|
||
|
<pre><code>Mozilla/5.0 (Macintosh; Intel Mac OS X 10_10_1) AppleWebKit/600.2.5 (KHTML, like Gecko) Version/8.0.2 Safari/600.2.5 (Amazonbot/0.1; +https://developer.amazon.com/support/amazonbot)
|
||
|
</code></pre></li>
|
||
|
|
||
|
<li><p>Most of them seem to be to community or collection discover and browse results pages like <code>/handle/10568/103/discover</code>:</p></li>
|
||
|
</ul>
|
||
|
|
||
|
<h1 id="zcat-force-var-log-nginx-access-log-gz-grep-e-0-9-1-2-oct-2019-grep-amazonbot-grep-o-e-get-bitstream-discover-handle-sort-uniq-c">zcat –force /var/log/nginx/<em>access.log.</em>.gz | grep -E “[0-9]{1,2}/Oct/2019” | grep Amazonbot | grep -o -E “GET /(bitstream|discover|handle)” | sort | uniq -c</h1>
|
||
|
|
||
|
<p>6566 GET /bitstream
|
||
|
351928 GET /handle</p>
|
||
|
|
||
|
<h1 id="zcat-force-var-log-nginx-access-log-gz-grep-e-0-9-1-2-oct-2019-grep-amazonbot-grep-e-get-bitstream-discover-handle-grep-c-discover">zcat –force /var/log/nginx/<em>access.log.</em>.gz | grep -E “[0-9]{1,2}/Oct/2019” | grep Amazonbot | grep -E “GET /(bitstream|discover|handle)” | grep -c discover</h1>
|
||
|
|
||
|
<p>214209</p>
|
||
|
|
||
|
<h1 id="zcat-force-var-log-nginx-access-log-gz-grep-e-0-9-1-2-oct-2019-grep-amazonbot-grep-e-get-bitstream-discover-handle-grep-c-browse">zcat –force /var/log/nginx/<em>access.log.</em>.gz | grep -E “[0-9]{1,2}/Oct/2019” | grep Amazonbot | grep -E “GET /(bitstream|discover|handle)” | grep -c browse</h1>
|
||
|
|
||
|
<p>86874</p>
|
||
|
|
||
|
<pre><code>
|
||
|
- As far as I can tell, none of their requests are counted in the Solr statistics:
|
||
|
|
||
|
</code></pre>
|
||
|
|
||
|
<p>$ http –print b ‘<a href="http://localhost:8081/solr/statistics/select?q=(ip%3A34.224.4.16+OR+ip%3A34.234.204.152)&rows=0&wt=json&indent=true'">http://localhost:8081/solr/statistics/select?q=(ip%3A34.224.4.16+OR+ip%3A34.234.204.152)&rows=0&wt=json&indent=true'</a></p>
|
||
|
|
||
|
<pre><code>
|
||
|
- Still, those requests are CPU intensive so I will add their user agent to the "badbots" rate limiting in nginx to reduce the impact on server load
|
||
|
- After deploying it I checked by setting my user agent to Amazonbot and making a few requests (which were denied with HTTP 503):
|
||
|
|
||
|
</code></pre>
|
||
|
|
||
|
<p>$ http –print Hh ‘<a href="https://dspacetest.cgiar.org/handle/10568/1/discover'">https://dspacetest.cgiar.org/handle/10568/1/discover'</a> User-Agent:“Amazonbot/0.1”
|
||
|
```</p>
|
||
|
|
||
|
<!-- vim: set sw=2 ts=2: -->
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
</article>
|
||
|
|
||
|
|
||
|
|
||
|
</div> <!-- /.blog-main -->
|
||
|
|
||
|
<aside class="col-sm-3 ml-auto blog-sidebar">
|
||
|
|
||
|
|
||
|
|
||
|
<section class="sidebar-module">
|
||
|
<h4>Recent Posts</h4>
|
||
|
<ol class="list-unstyled">
|
||
|
|
||
|
|
||
|
<li><a href="/cgspace-notes/2019-11/">November, 2019</a></li>
|
||
|
|
||
|
<li><a href="/cgspace-notes/cgspace-cgcorev2-migration/">CGSpace CG Core v2 Migration</a></li>
|
||
|
|
||
|
<li><a href="/cgspace-notes/2019-10/">October, 2019</a></li>
|
||
|
|
||
|
<li><a href="/cgspace-notes/2019-09/">September, 2019</a></li>
|
||
|
|
||
|
<li><a href="/cgspace-notes/2019-08/">August, 2019</a></li>
|
||
|
|
||
|
</ol>
|
||
|
</section>
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
<section class="sidebar-module">
|
||
|
<h4>Links</h4>
|
||
|
<ol class="list-unstyled">
|
||
|
|
||
|
<li><a href="https://cgspace.cgiar.org">CGSpace</a></li>
|
||
|
|
||
|
<li><a href="https://dspacetest.cgiar.org">DSpace Test</a></li>
|
||
|
|
||
|
<li><a href="https://github.com/ilri/DSpace">CGSpace @ GitHub</a></li>
|
||
|
|
||
|
</ol>
|
||
|
</section>
|
||
|
|
||
|
</aside>
|
||
|
|
||
|
|
||
|
</div> <!-- /.row -->
|
||
|
</div> <!-- /.container -->
|
||
|
|
||
|
|
||
|
|
||
|
<footer class="blog-footer">
|
||
|
<p dir="auto">
|
||
|
|
||
|
Blog template created by <a href="https://twitter.com/mdo">@mdo</a>, ported to Hugo by <a href='https://twitter.com/mralanorth'>@mralanorth</a>.
|
||
|
|
||
|
</p>
|
||
|
<p>
|
||
|
<a href="#">Back to top</a>
|
||
|
</p>
|
||
|
</footer>
|
||
|
|
||
|
|
||
|
</body>
|
||
|
|
||
|
</html>
|