tomcatsearchtomcat8opengrokcode-search-engine

How to track usage of OpenGrok service


What are some ways we could monitor OpenGrok, both usage and specific searches? Is there any systems either built in or that can be added as extensions?

We are running OpenGrok on the intranet but we have no visibility of how it's being used and how much usage it gets.

Install

Currently OpenGrok is being installed through a puppet pipeline.

class opengrok {
  package {[
    'opengrok-tomcat',
    'ctags',
  ]

...

file { '/usr/share/tomcat8/webapps/opengrok-1.0':
  ensure  => directory,
  owner   => 'root',
  group   => 'root',
  mode    => '0755',
}

What are some ways I could monitor OpenGrok, both usage and specific searches and/or more?

Preliminary ideas:

1) Add a proxy forwarding endpoint in front of opengrok to record the "hits" and send it to some DB store. That wouldn't track low level usage of opengrok (i.e. search queries), just the hits.

2) Somehow enable tomcat logs and parse through the logs? I'm not sure how much info I would get from the logs and the parsing might get involved. Then send this info to some DB store.


Solution

  • We use Nginx like a proxy server to OpenGrok, so we have all OpenGrok searches logged at /var/log/nginx/access.log* files, where you can get a lot of information like, for example, the following:

    COMPUTER-IP - USER [27/Sep/2018:10:17:30 -0300] "GET /xxxxx/search?project=sandbox_helloworld%28master%29&q=This+is+a+test&defs=&refs=&path=&hist=&type=sh HTTP/1.1" 200 3345 "https://OPENGROK-SERVER/xxxxx/search?project=sandbox_helloworld%28master%29&q=This+is+a+test&defs=&refs=&path=&hist=&type=" "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/69.0.3497.100 Safari/537.36"