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

Ability to generate HTML report without Javascript (for mailing) #685

Open
coderonline opened this Issue Mar 9, 2017 · 15 comments

Comments

Projects
None yet
7 participants
@coderonline
Copy link

commented Mar 9, 2017

The man page states "You can even email the HTML file since it is composed of a single file with no external file dependencies, how neat is that!" and that is basically right, but I have configured it and noticed, that those mails are not getting displayed directly.

However it is possible to make an attachment out of it and to open that in a browser, but the internal browser of my Thunderbird does not support javascript (to be more precise has it been deactivated by purpose years ago). I think it would be great to have html reports without that javascript requirement.

@allinurl

This comment has been minimized.

Copy link
Owner

commented Mar 11, 2017

I definitely agree that having an HTML-only report would be nice (or even a plain text report). Versions prior to v1.0 did this, however, now it's going to be a challenge since all the rendering is done given a JSON object which then is parsed by the templating engine to finally build the document.

I wonder if there is a tool out there that can parse the JS report and spit out a pure HTML report or if it would need to be built-in within goaccess.

@allinurl allinurl changed the title Suggestion: HTML reports without javascript (for mailing) Ability to generate HTML report without Javascript (for mailing) Mar 11, 2017

@mserious

This comment has been minimized.

Copy link

commented Mar 17, 2017

+1. That would be a nice feature to have.

@Lusitaniae

This comment has been minimized.

Copy link

commented Mar 19, 2017

Perhaps we could use Casperjs to obtain the resulting HTML.
http://docs.casperjs.org/en/latest/modules/casper.html#gethtml

It will simulate a browser and render the page as one. We can thereafter save the HTML or take screenshots, of the full page or portions of it.

Might be too much of an hassle to bring a dependency for this small feature.

What do you guys thing?

@allinurl

This comment has been minimized.

Copy link
Owner

commented Mar 20, 2017

@Lusitaniae Thanks for posting that link. it looks like that could help, but like you said, the dependency would be a hassle.

I was looking at what it would take to make that report pure html/css and I think generating it as it used to be in previous versions of goaccess wouldn't be too bad. The only issue is maintaining both versions (JS and straight static). A caveat is that it would only work to generate a static report (wouldn't work with --real-time-html).

@anarcat

This comment has been minimized.

Copy link

commented Nov 3, 2017

i'd love to see a plain-text export as well... i'm still using analog right now because if this and well.. that's painful. :)

@anarcat

This comment has been minimized.

Copy link

commented Nov 3, 2017

for what it's worth, i'm using the following pipeline in a cronjob now:

#!/bin/sh

gunzip -c /var/log/access.log.*.gz \
 | goaccess --exclude-ip 10.0.0.6 --ignore-referer=example.com \
   --with-output-resolver \
   /var/log/access.log.0 /var/log//access.log \
 | mail -a 'Content-type: text/html' -s 'goaccess weekly stats' me@example.com

this mostly works - even though my email client doesn't support HTML (let alone javascript) so well, i can open this in a web browser and get the graphics display in all its glory. it would still be nice to have a text-friendly format.

@dafky2000

This comment has been minimized.

Copy link

commented Dec 1, 2017

Hey guys, I wrote a little template placeholder replacement library. It is written in C so would be easy to implement with GoAccess. Just write up the plain HTML files loaded with placeholders and fill them with data upon request.

I would happy to help if needed. https://github.com/dafky2000/simplectemplate

@allinurl

This comment has been minimized.

Copy link
Owner

commented Dec 2, 2017

@dafky2000 Thanks for posting this. It certainly looks nice and handy :) especially since it may address this issue (#685). Though, I'd like to keep one set of templates (for maintainability) that work with the current JSON output (for clients with JS-enabled) and if possible use your code to generate from the same templates the same output but as plain HTML.

That brings me to the next question, is simplectemplate able to handle loops and conditionals? I believe I'm currently using some in the current mustache code? Thanks.

@dafky2000

This comment has been minimized.

Copy link

commented Dec 3, 2017

Currently it is logic-less. Right now it is essentially a search and replace tool.

I have plans to support "conditionals" with dafky2000/simplectemplate#23. Basically if the data.value has any value (is not null or an empty string), than proceed to use the text after the first space.

I have created an issue to support loops. dafky2000/simplectemplate#51

These are both dependent on nested placeholders (dafky2000/simplectemplate#22) otherwise aren't super useful.

I use a javascript version of this library at work but need the functionality server side too. dafky2000/simplectemplate#23 and dafky2000/simplectemplate#22 are required for me to use simplectemplate in that project. If simplectemplate (with the added features) would work for your use-case too, I would make them a higher priority :)

@allinurl

This comment has been minimized.

Copy link
Owner

commented Dec 3, 2017

I do like where your project is going :) It would be great if you could make it compatible with mustache though. I'd definitely give it a shot and try to incorporate it into goaccess if I could use the same templates I currently use, mainly cause it would be a pain to maintain multiple duplicate templates.

@dafky2000

This comment has been minimized.

Copy link

commented Dec 3, 2017

Ok, give me some time with that, I think it would very valuable as well.

@dafky2000

This comment has been minimized.

Copy link

commented Jan 6, 2018

Just wanted to drop a ping and let you know I am making good progress with those issues. Just pushed to https://github.com/dafky2000/simplectemplate/tree/i23 I was able to implement it in a way so the format is pretty customizable but the default style is mustache syntax!

Just fixing up a couple leftover TODO items and then need to implement loops :)

There are a couple new tests here:
https://github.com/dafky2000/simplectemplate/blob/0b4a865b220bea5dbee20c8e82eeb4651458e3bc/spec/template_functions_render_template.c#L96

@allinurl

This comment has been minimized.

Copy link
Owner

commented Jan 9, 2018

@dafky2000 Thanks for the update. Certainly looking forward to it :)

@qijianjun

This comment has been minimized.

Copy link

commented Oct 6, 2018

I write a python script to generate plain html report, it use the goaccess bright theme, now it's available at https://github.com/qijianjun/goaccess-render-plain-html

@allinurl

This comment has been minimized.

Copy link
Owner

commented Oct 8, 2018

@qijianjun Thanks for sharing that. This is great!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.