Generate CSV Report from Apache Log File

Q

How to Generate CSV Report from Apache Log File?

✍: FYIcenter.com

A

If you want to Generate CSV Reports from an Apache Web server log file, you can follow these steps:

1. Set the output file with an .csv extension:

fyicenter$ goaccess access_log -o report.csv

fyicenter$ more report.csv
"0",,"general",,,,,,,,"2022-12-08 08:51:17 +0800","date_time"
"1",,"general",,,,,,,,"1020","total_requests"
"2",,"general",,,,,,,,"1020","valid_requests"
"3",,"general",,,,,,,,"0","failed_requests"
"4",,"general",,,,,,,,"1","generation_time"
"5",,"general",,,,,,,,"38","unique_visitors"
"6",,"general",,,,,,,,"185","unique_files"
"7",,"general",,,,,,,,"0","excluded_hits"
"8",,"general",,,,,,,,"0","unique_referrers"
"9",,"general",,,,,,,,"3","unique_not_found"
"10",,"general",,,,,,,,"45","unique_static_files"
"11",,"general",,,,,,,,"245475","log_size"
"12",,"general",,,,,,,,"439320800","bandwidth"
"13",,"general",,,,,,,,"access_log","log_path"
"0",,"visitors","48","4.71%","2","5.26%","4711631","1.07%",,,"20221208"
"1",,"visitors","310","30.39%","10","26.32%","174895913","39.81%",,,"20221207"
"2",,"visitors","570","55.88%","17","44.74%","220755614","50.25%",,,"20221206"
"3",,"visitors","92","9.02%","9","23.68%","38957642","8.87%",,,"20221205"
"0",,"requests","107","10.49%","18","47.37%","220433","0.05%","GET","HTTP/1.1","/index.php"
"1",,"requests","65","6.37%","9","23.68%","1180236","0.27%","GET","HTTP/1.1","/report.php"
"2",,"requests","49","4.80%","0","0.00%","0","0.00%","---","---","-"
"3",,"requests","33","3.24%","9","23.68%","699771","0.16%","GET","HTTP/1.1","/project.php"
"4",,"requests","23","2.25%","7","18.42%","11783977","2.68%","POST","HTTP/1.1","/search.php"
...

2. Use "--no-csv-summary" option to skip the summary part:

fyicenter$ goaccess access_log -o report.csv --no-csv-summary 

fyicenter$ more report.csv
"0",,"visitors","48","4.71%","2","5.26%","4711631","1.07%",,,"20221208"
"1",,"visitors","310","30.39%","10","26.32%","174895913","39.81%",,,"20221207"
"2",,"visitors","570","55.88%","17","44.74%","220755614","50.25%",,,"20221206"
"3",,"visitors","92","9.02%","9","23.68%","38957642","8.87%",,,"20221205"
"0",,"requests","107","10.49%","18","47.37%","220433","0.05%","GET","HTTP/1.1","/index.php"
"1",,"requests","65","6.37%","9","23.68%","1180236","0.27%","GET","HTTP/1.1","/report.php"
"2",,"requests","49","4.80%","0","0.00%","0","0.00%","---","---","-"
"3",,"requests","33","3.24%","9","23.68%","699771","0.16%","GET","HTTP/1.1","/project.php"
"4",,"requests","23","2.25%","7","18.42%","11783977","2.68%","POST","HTTP/1.1","/search.php"
...

 

Generate JSON Report from Apache Log File

"No time format was found on your conf file" Error

Customizing GoAccess

⇑⇑ GoAccess - Frequently Asked Questions

2023-01-06, 380🔥, 0💬