Skip to content

Instantly share code, notes, and snippets.

@TiloGit
Forked from soheilpro/example.sh
Created July 17, 2025 23:03
Show Gist options
  • Select an option

  • Save TiloGit/dc59fd710f4e98fc9da4d0ca27ac6f79 to your computer and use it in GitHub Desktop.

Select an option

Save TiloGit/dc59fd710f4e98fc9da4d0ca27ac6f79 to your computer and use it in GitHub Desktop.

Revisions

  1. @soheilpro soheilpro revised this gist Jun 30, 2015. 2 changed files with 2 additions and 0 deletions.
    File renamed without changes.
    2 changes: 2 additions & 0 deletions goiisformat.sh
    Original file line number Diff line number Diff line change
    @@ -1,3 +1,5 @@
    #!/usr/bin/env sh

    while read line; do
    if [[ $line == \#Fields:* ]]; then
    line=${line/\#Fields: /}
  2. @soheilpro soheilpro revised this gist Jun 30, 2015. 1 changed file with 1 addition and 1 deletion.
    2 changes: 1 addition & 1 deletion goiisformat.sh
    Original file line number Diff line number Diff line change
    @@ -22,7 +22,7 @@ while read line; do
    line=${line/sc-win32-status/%^}
    line=${line/sc-bytes/%b}
    line=${line/cs-bytes/%^}
    line=${line/time-taken/%D}
    line=${line/time-taken/%L}
    echo $line
    exit;
    fi
  3. @soheilpro soheilpro created this gist Jun 30, 2015.
    1 change: 1 addition & 0 deletions Example.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1 @@
    goaccess -f u_ex150629.log --log-format "$(cat u_ex150629.log | ./goiisformat.sh)" --date-format '%Y-%m-%d' --time-format '%H:%M:%S'
    29 changes: 29 additions & 0 deletions goiisformat.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,29 @@
    while read line; do
    if [[ $line == \#Fields:* ]]; then
    line=${line/\#Fields: /}
    line=${line/date/%d}
    line=${line/time/%t}
    line=${line/s-sitename/%^}
    line=${line/s-computername/%^}
    line=${line/s-ip/%^}
    line=${line/cs-method/%m}
    line=${line/cs-uri-stem/%U}
    line=${line/cs-uri-query/%^}
    line=${line/s-port/%^}
    line=${line/cs-username/%^}
    line=${line/c-ip/%h}
    line=${line/cs-version/%H}
    line=${line/cs(User-Agent)/%u}
    line=${line/cs(Cookie)/%^}
    line=${line/cs(Referer)/%R}
    line=${line/cs-host/%^}
    line=${line/sc-status/%s}
    line=${line/sc-substatus/%^}
    line=${line/sc-win32-status/%^}
    line=${line/sc-bytes/%b}
    line=${line/cs-bytes/%^}
    line=${line/time-taken/%D}
    echo $line
    exit;
    fi
    done