I want to parse out data out of a log file which consist of JSON sting and I wonder if there's a way for me to use a bash function to perform any custom parsing instead of overloading
tail errors.log --follow | jq --raw-output '. | [.server_name, .server_port, .request_file] | @tsv'
18.104.22.168 80 /var/www/domain.com/www/public
I want to parse 3rd column to cut the string to exclude
/var/www/domain.com part where
/var/www/domain.com is the document root, and
/var/www/domain.com/subdomain/public is the public
html section of the site. Therefore I would like to leave my output as
/subdomain/public (or from the example
I wonder if I can somehow inject a bash function to parse
.request_file column? Or how would I do that using
I'm having issues piping out the output of any part of this command that would allow me to do any sort of string manipulation.