Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tracking downloads with plausible and ERDDAP #172

Open
JessyBarrette opened this issue Feb 15, 2024 · 17 comments
Open

Tracking downloads with plausible and ERDDAP #172

JessyBarrette opened this issue Feb 15, 2024 · 17 comments
Assignees

Comments

@JessyBarrette
Copy link
Contributor

#166 is getting close to be able to running accordingly and need a few fine tuning and clean. One issue left is to be able to track the data downloads via plausible.

We can easily deploy scripts via the init.d folder within an erddap container and I think this would be the ideal method to implement the plausible download tracker.

@fostermh How is setup right now your log scrapper for tracking downloads. Can we include the dependacies within a Dockerfile and add the script via an executable file?

See example of the Dockerfile: here

and list of executable to run on the container start here: https://github.com/HakaiInstitute/hakai-datasets/tree/caprover-deploy/init.d

Any files within init.d set as executable or matching. *.sh will get executed when a container is started.

@JessyBarrette
Copy link
Contributor Author

After talking with @fostermh

Since the present method @fostermh use is using the appache log on top of the container. We will attempt to log usage by having a second container running in parallel that access the nginx log of the caprover erddap app.

The initial method was using appache, Matt will review if this method is compatible with NGINX which is used by caprover.

@JessyBarrette
Copy link
Contributor Author

In consequence, we will ignore this present issue while developing #166

@fostermh
Copy link
Contributor

fostermh commented Feb 15, 2024

expanding on the details Jessy has already posted.

We will attempt to use telegraf running in a docker container to parse the nginx logs from caprover. This mirrors the current production setup in which erddap is running behind a proxy (apache) and telegraf is used to scrape the apache logs and report back on erddap usage.

TODO:

https://github.com/cioos-siooc/cwatch-telegraf

@steviewanders
Copy link

steviewanders commented Feb 15, 2024 via email

@JessyBarrette
Copy link
Contributor Author

Just to add to present thread. Looks like ERDDAP itself is also suggesting to use the Tomcat/Apache/(NGINX?) log to track statistics and usage.
https://coastwatch.pfeg.noaa.gov/erddap/download/setup.html#tomcatLogs

@fostermh not sure if you started developing this after reading the ERDDAP docs but this is reassuring to see :)

@fostermh
Copy link
Contributor

I had not read the docs but yes nice to see that we independently arrived at the same solution. Hopefully we are on the correct track. :-)

@steviewanders
Copy link

@fostermh Thanks, I'll give this a shot on the development instance next week.

@steviewanders
Copy link

steviewanders commented Apr 9, 2024

Other options I've used to parse NGINX - out of the box - in the past.
These need to be ruled out before a custom setup is attempted.

@steviewanders
Copy link

[x] https://goaccess.io/

https://github.com/HakaiInstitute/erddap-goaccess

There is an example report.html in there we will need to check against requirements.

@fostermh
Copy link
Contributor

fostermh commented Apr 15, 2024

telegraf is scraping logs for the development version of erddap

@steviewanders
Copy link

steviewanders commented Apr 15, 2024

Amazing "scrapping".

At the next ERDDAP 2.0 meeting lets compare and contrast and figure out what next or if this is oh so done.

@fostermh
Copy link
Contributor

haha spelling corrected. Yes would be good to contrast, sounds good.

@JessyBarrette
Copy link
Contributor Author

I just had a quick look at the plausible and for some reasons the urls it refers to have a section doubled:

https://development.erddap.hakai.appdevelopment.erddap.hakai.app/erddap/tabledap/HakaiBamfieldBoL5min.htmlTable

Must be something related to the setup with plausible.

@fostermh
Copy link
Contributor

sorted. the host_url environment variable must contain the protocol, which I had forgotten to include in the telegraf setup. Thanks for noticing.

@JessyBarrette
Copy link
Contributor Author

I just ran sucessfully on development.erddap.hakai.app/erddap the cde harvester. You should now
have logged a number of different csv querries to the erddap. :)

I think we should have all we need now

@steviewanders
Copy link

Nice! Lets meet at the end of this week and review these two analytics quick.

@steviewanders
Copy link

steviewanders commented Apr 22, 2024

  • @steviewanders Needs to add this to an analytics section of the resulting documentation & diagram but basically:
  • https://github.com/allinurl/goaccess works to see all requests NGINX serves, which allows us to sort between monitoring bots, our own API requests (CDE et al.), and normal users of the HTML pages
  • The specific setup for the above is here https://github.com/HakaiInstitute/erddap-goaccess
  • It relies upon a NGINX access.log being persisted outside the ERDDAP container to the EC2 file system, which could benefit from a simple backup in case of $something_bad
  • Need to add a weekly cron job to generate a report and dump it and the log to S3
  • Plausible can and has been added to the HTML template for ERDDAP so it runs as a client side Javascript tracker just GA
  • Combined, these two address our two usage questions around ERDDAP.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants