Last active
October 15, 2019 14:15
-
-
Save leegin/c8337075e5d2ccda1ebdcbdff32f1d2d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#/bin/bash | |
#Script to parse the log to get IP address and URL and then convert it to json | |
read -p "Enter the name of the log file which you want to parse: " file | |
less $file | awk '{print $1","$15}' | grep http | cut -d ")" -f1 | sed 's/+//' > data.txt | |
jq -Rs '[ split("\n")[] | select(length > 0) | split(",") | {IP_address: .[0], URL: .[1]} ]' data.txt > data.json |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment