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

Goaccess terminal dashboard shortcut keys not working. #185

Open
jaggerwang opened this issue Nov 7, 2014 · 21 comments
Open

Goaccess terminal dashboard shortcut keys not working. #185

jaggerwang opened this issue Nov 7, 2014 · 21 comments

Comments

@jaggerwang
Copy link

I'm connecting remote CentOS 6 server from iTerm 2 on Mac OS X. When I run goaccess command remotely, the dashboard display ok, and shortcut keys like 'h' and 'q' working correctly, but not the Expand and Scroll keys, I can only see the first screen content.

@allinurl
Copy link
Owner

allinurl commented Nov 7, 2014

Let me get my hands on a Mac to test this.

BTW, does it work with Enter or right-arrow to expand the panel? Also, does this only happen on iTerm 2 or also in Terminal.app? Thanks

@allinurl allinurl added the bug label Nov 7, 2014
@jaggerwang
Copy link
Author

Enter and Right-arror also not working. Goaccess is very useful for us, thanks for your work!

在 2014年11月8日,05:29,Gerardo O. notifications@github.com 写道:

Let me get my hands on a Mac to test this.

BTW, does it work with Enter or right-arrow to expand the panel? Also, does this only happen on iTerm 2 or also in Terminal.app? Thanks


Reply to this email directly or view it on GitHub #185 (comment).

@allinurl
Copy link
Owner

allinurl commented Nov 8, 2014

Are you using tmux or screen at all?

@jaggerwang
Copy link
Author

No, just iTerm2 with zsh.

在 2014年11月8日,09:31,Gerardo O. notifications@github.com 写道:

Are you using tmux or screen at all?


Reply to this email directly or view it on GitHub #185 (comment).

@allinurl
Copy link
Owner

allinurl commented Nov 9, 2014

OK, I tested this on iTerm2 Build 2.0 ssh"ing into a remote machine and it works fine (with and without tmux). Also I installed goaccess directly into OS X 10.9.4 through brew and keys work fine. What keys are you using to scroll within the panel? j and k? Thanks

@jaggerwang
Copy link
Author

I tried j, k, ctrl+f and ctrl+b, no one is working, but h, q and tab is ok.

在 2014年11月9日,08:07,Gerardo O. notifications@github.com 写道:

OK, I tested this on iTerm2 Build 2.0 ssh"ing into a remote machine and it works fine (with and without tmux). Also I installed goaccess directly into OS X 10.9.4 through brew and keys work fine. What keys are you using to scroll within the panel? j and k? Thanks


Reply to this email directly or view it on GitHub #185 (comment).

@allinurl
Copy link
Owner

what version of goaccess are you running and the version of iTerm2? Could you also please post the result of: echo $TERM? Thanks

@jaggerwang
Copy link
Author

➜ ~ echo $TERM
xterm

[worker@lusir-aws-app1 ~]$ goaccess --version
GoAccess - 0.8.3.
For more details visit: http://goaccess.io
Copyright (C) 2009-2014 GNU GPL'd, by Gerardo Orellana

在 2014年11月11日,09:49,Gerardo O. notifications@github.com 写道:

what version of goaccess are you running and the version of iTerm2? Could you also please post the result of: echo $TERM? Thanks


Reply to this email directly or view it on GitHub #185 (comment).

@allinurl
Copy link
Owner

I've been testing this for a while but I can't replicate the issue. Tested with iTerm 1.0 and 2.0, within bash and zsh, setting TERM to xterm and xterm-256color. Can you provide a bit more info on your environment? Does it work for you using Terminal.app? FWIW, here's the output I get:

goaccess

Anybody else having this issue?

@jaggerwang
Copy link
Author

It’s the same for Terminal.app, and I also tried run goaccess locally both in iTerm2 and Terminal. I wanted to confirm there is no need to press ctrl or any other key to combine with j, k or enter?

在 2014年11月11日,12:05,Gerardo O. notifications@github.com 写道:

I've been testing this for a while but I can't replicate the issue. Tested with iTerm 1.0 and 2.0, within bash and zsh, setting TERM to xterm and xterm-256color. Can you provide a bit more info on your environment? Does it work for you using Terminal.app? FWIW, here's the output I get:

https://cloud.githubusercontent.com/assets/5005367/4988210/669ee992-6925-11e4-942a-f94e564041c0.gif
Anybody else having this issue?


Reply to this email directly or view it on GitHub #185 (comment).

@allinurl
Copy link
Owner

@jaggerwang no need for pressing ctrl or any other key. I'll look into this a bit further and see if I can replicate it. Feel free to post any other insights you may have.

@arondeparon
Copy link

Just wanted to let you know that I am experiencing this as well. Have tried this both on Terminal.app and iTerm2, both with same results. Server is a CentOS 5 machine.

@allinurl
Copy link
Owner

allinurl commented Oct 3, 2015

@arondeparon Interesting, could you run the following in your server and post the output after pressing the following keys:

h
j
k
o
c
s
/
<Ctrl> + f
<Ctrl> + b
g
<Shift> + g
n
<Tab>
<Shift> + <tab>
<Arrow right>
<Arrow down>
<Arrow up>
<Arrow left>
<Enter>

Here's the c program, copy this into your server and name the file keys.c

#include <curses.h>
int main(void) {
    WINDOW * _window = initscr();
    cbreak();

    /* Accept all keys */
    keypad(_window, true);

    /* Don't echo things that are typed */
    noecho();

    /* Don't display cursor */
    curs_set(0);

    for (;;) {
        printw("Press a Key ");
        refresh();
        int key = wgetch(_window);
        printw("%c, %d \n", key, key);
    }
    endwin();

    return 0;
}

compile with:

gcc keys.c -lncurses

Thanks!

@arondeparon
Copy link

Hi,

Here is the output:

Press a Key h, 104
Press a Key j, 106
Press a Key k, 107
Press a Key o, 111
Press a Key c, 99
Press a Key s, 115
Press a Key /, 47
Press a Key ^F, 6
Press a Key ^B, 2
Press a Key g, 103
Press a Key G, 71
Press a Key n, 110
Press a Key     , 9
Press a Key a, 353
Press a Key ^E, 261
Press a Key ^B, 258
Press a Key ^C, 259
Press a Key ^D, 260
Press a Key
, 10

@allinurl
Copy link
Owner

allinurl commented Oct 4, 2015

I get exactly the same key codes. BTW, are you using zsh as well? Does this happen if you run goaccess locally in your mac?

Also could you please try again the following code, it should replicate goaccess' settings:

#include <curses.h>
int main(void) {
    initscr();
    clear();
    noecho();
    halfdelay(10);
    nonl();
    intrflush(stdscr, FALSE);
    keypad(stdscr, TRUE);
    curs_set(0);
    mousemask(BUTTON1_CLICKED, NULL);
    cbreak();

    for (;;) {
        printw("Press a Key "); 
        refresh();
        int key = wgetch(stdscr);

        printw("%c, %d", key, key);
        switch (key) {
            case 'h' : printw("` - h pressed`");         break ;
            case 'g' : printw("` - g pressed`");         break ;
            case 'G' : printw("` - G pressed`");         break ;
            case 'n' : printw("` - n pressed`");         break ;
            case '/' : printw("` - / pressed`");         break ;
            case 106 : printw("` - j pressed`");         break ;
            case 107 : printw("` - k pressed`");         break ;
            case 115 : printw("` - s pressed`");         break ;
            case 2   : printw("` - Ctrl+b pressed`");    break ;
            case 338 : printw("` - pg+down pressed`");   break ;
            case 339 : printw("` - pg+up pressed`");     break ;
            case 353 : printw("` - shift+tab pressed`"); break ;
            case 6   : printw("` - Ctrl+f pressed`");    break ;
            case 99  : printw("` - c pressed`");         break ;
            case 9   : printw("` - tab pressed`");       break ;
            case 0x0a:
            case 0x0d:
            case 32: 
            case KEY_ENTER:
                printw("` - ENTER pressed`");
                break;
        }   
        printw("\n", key, key);
    }   
    endwin();

    return 0;
}

Thanks again.

@arondeparon
Copy link

Hi,

Thanks for the assist! I'm using zsh on OSX and received the same output when compiling locally.
I compiled and ran your latest code on my CentOS machine and received the following output:

Press a Key h, 104` - h pressed`
Press a Key j, 106` - j pressed`
Press a Key k, 107` - k pressed`
Press a Key o, 111
Press a Key c, 99` - c pressed`
Press a Key s, 115` - s pressed`
Press a Key /, 47` - / pressed`
Press a Key ^F, 6` - Ctrl+f pressed`
Press a Key ^B, 2` - Ctrl+b pressed`
Press a Key g, 103` - g pressed`
Press a Key G, 71` - G pressed`
Press a Key n, 110` - n pressed`
Press a Key     , 9` - tab pressed`
Press a Key a, 353` - shift+tab pressed`
Press a Key ^E, 261
Press a Key ^B, 258
Press a Key ^C, 259
Press a Key ^D, 260
, 13` - ENTER pressed`

@aphorise
Copy link

This is most likely an issue with the user-locale and or terminal application preferences in use by user settings rather than a bug or issue with GoAccess.

I've also attempted to recreate this issue using GoAccess 0.9 within a bare minimal CentOS 5, OSX with a different language (Dutch) & iTerm2. I did not adjust or set LANG or other environment variables related to language on the host / server CentOS machine :

[user@cent5-zsh goaccess]$ locale
# LANG=
# LC_CTYPE="POSIX"
# LC_NUMERIC="POSIX"
# LC_TIME="POSIX"
# LC_COLLATE="POSIX"
# LC_MONETARY="POSIX"
# LC_MESSAGES="POSIX"
# LC_PAPER="POSIX"
# LC_NAME="POSIX"
# LC_ADDRESS="POSIX"
# LC_TELEPHONE="POSIX"
# LC_MEASUREMENT="POSIX"
# LC_IDENTIFICATION="POSIX"
# LC_ALL=

The system was configured with US defaults:

[user@cent5-zsh goaccess]$ sudo yum install system-config-language && sudo system-config-language
#|--------------------------------------|
#| Select the language for the system.  │
#│           English (USA)              |
#│   | OK |                 | Cancel |  │
#|--------------------------------------|

My iTerm2 profile was as follows:
iTerm2 profile settings

I then went through the following series:

key sequence
1, enter (expand top requests)
page-up, page-down (section-scroll)
j, k (section-scroll)
1 (contract top requests)
1, o (expand top requests again)
UP, DOWN (view scroll keeping current section open).
5, enter (expand top visitors)
page-up, page-down (section-scroll)
j, k (section-scroll)

I did not experience any problems so at this point the issue (if any) is not clear and neither is it detailed or elaborated well enough to determine.

I'd advise those involved to review their locale settings of their localhost / machine relative to those of the remote server and what maybe forward. So for example:

[user@cent5-zsh goaccess]$ sudo grep 'LC_' /etc/ssh/sshd_config
# AcceptEnv LANG LANGUAGE LC_CTYPE LC_NUMERIC LC_TIME LC_COLLATE LC_MONETARY LC_MESSAGES
# AcceptEnv LC_PAPER LC_NAME LC_ADDRESS LC_TELEPHONE LC_MEASUREMENT
# AcceptEnv LC_IDENTIFICATION LC_ALL
#//-----------------------------
#// ^^^ I normally set forwarding / accepting of thse OFF!

@rauberdaniel
Copy link

I’m getting this issue in Terminal.app and GoAccess version 1.5 when I try to evaluate about 3000 files (AWS CloudFront logs). The key commands work at first but after a short time (several seconds, not consistent) GoAccess seems to completely freeze. Maybe this is an issue with files not being closed after reading and therefore running into some OS limitation?

If I combine all these files into one single file (e.g. cat *.log >> combined.log) and load that with GoAccess afterwards, the issue does not seem to appear.

@allinurl
Copy link
Owner

@rauberdaniel Thanks for reporting this. Can I ask, are those 3000 logs being constantly updated or mostly static? Also, does it make any difference if you feed goaccess using tail as:

tail -qF access.log access.1.log access.2.log | goaccess - --log-format=COMBINED

@rauberdaniel
Copy link

No, those files are static and not updated at all (therefore, they could be closed after reading).

I just tried feeding them via

cat *.log | goaccess - --log-format=CLOUDFRONT

and it seems to work fine without freezing.

What I also just realized is that simply using goaccess *.log … doesn't even load all the files, only about half the amount of requests are shown as compared to the command with cat. I think that could match to the possible issue of too many open files ( https://superuser.com/questions/433746/is-there-a-fix-for-the-too-many-open-files-in-system-error-on-os-x-10-7-1 ) as goaccess itself tries to keep reading those files and therefore doesn’t close them?

@allinurl
Copy link
Owner

Good question, goaccess doesn't keep the files opened.

I pushed a fix for this, it should work fine. Please feel free to build from development and let me know if that solves the issue on your end. You may still need to change your max number of files that can be opened in your OS. Ideally goaccess could resort to inotify, however it would need to work across all platforms, including BSDs, etc.

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

No branches or pull requests

5 participants