How to use my custom log format?
I can't figure how to get goaccess to read my log file. It says
Fatal error has occurred Error occured at: goaccess.c - main - 832 Nothing valid to process.
This is my log definition in Apache:
[%{%a %b %d %H:%M:%S %Y}t] %v:%p - %h (PID %P %Dus) %u \"%r\" %>s %b \"%{Referer}i\" \"% User-Agent}i\"
This is an example log entry from it:
[Sun Apr 05 01:14:01 2015] www.site.com:80 - 143.81.103.52 (PID 5854 40913us) - "GET /accommodations.html HTTP/1.1" 200 13242 "http://site.com/culinary.html" "Mozilla/5.0 (Windows NT 6.1; Win64; x64; Trident/7.0; rv:11.0) like Gecko"
This is what I tried for log-format in goaccess.conf
log-format [%{%a %b %d %H:%M:%S %Y}t] %v:%p - %h (PID %P %Dus) %u "%r" %>s %b
Any idea how to get this to work?
The following formats should do it:
log-format [%d %t %^] %^ %^ %h %^"%r" %s %b "%R" "%u"
date-format %a %b %e
time-format %H:%M:%S
I can't specify time-format in goaccess.conf. It says goaccess: unrecognized option '--time-format' when I try to run it?
time-format was intoruced on v0.9. You may want to update or use:
log-format [%d %^] %^ %^ %h %^"%r" %s %b "%R" "%u"
date-format %a %b %e
Closing this. Feel free to reopen if needed.
Just installed this tool today via brew install goaccess
I was trying to use --time-format
goaccess --version
GoAccess - 0.8.5.
For more details visit: http://goaccess.io
Copyright (C) 2009-2014 GNU GPL'd, by Gerardo Orellana
With the help of this guy https://github.com/allinurl/goaccess/issues/258#issuecomment-117190010
I also changed the original script to support my log format from iis https://gist.github.com/soheilpro/a34957550b1bd7d42be2#gistcomment-1742140
My log: May 22 15:28:02 hostname process: message
What is the right regex for date time and log format. I keep getting Verify your date/time/log format error
@chethanv28 Is your log a web access log? e.g., nginx, apache, etc... goaccess is a web log analysis tool.
syslog
@chethanv28 if your syslog doesn't contain access logs then you'd need a different tool to analyze it.
what should be the format for my log file:
Info: 2018/02/22 13:59:06 redis.go:15: Initializing redis
Thanks
@shivkumarsingh7 your log doesn't look like a web log (access.log), you'd need a different tool to analyze it.
Thanks @allinurl , Can you guide me how to do that?
@shivkumarsingh7 I'd suggest browsing or exploring relevant topics, e.g., analytics.
how to name my custom format in ~/.goaccessrc ? I have customized nginx access_log, customize parser for goaccess and want to save it. May be I misread manpages, but not found this
@desempare You can simply set your log format in your ~/.goaccessrc as
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u"
date-format %d/%b/%Y
time-format %H:%M:%S
Take a look at this script if you need to convert an nginx format to goaccess. Also the man page.
@desempare You can simply set your log format in your ~/.goaccessrc as
log-format %h %^[%d:%t %^] "%r" %s %b "%R" "%u" date-format %d/%b/%Y time-format %H:%M:%STake a look at this script if you need to convert an nginx format to goaccess. Also the man page.
Yeah, I make it already, but how to simply call my format (may be I have more than one), only write various cfg files ? Thank you
I mean goaccess --log-format=myformat1 mylog.log, goaccess --log-format=myformat2 myotherlog.log, something like that.
@desempare Unfortunately multiple log formats are not supported at the moment, you will need to parse them separately.
How use goaccess with other filelog. Can i use in different format ? For example log file: Nov 27 08:22:46 kzn-mtts-br-01 KZN-MTTS-BR-01-RE1 mib2d[21987]: %DAEMON-4-SNMP_TRAP_LINK_DOWN: ifIndex 1068, ifAdminStatus up(1), ifOperStatus down(2), ifName xe-4/1/0
@fanfaronDo, you can indeed employ various format specifiers. However, I'm uncertain about the type of log you're attempting to analyze, as it doesn't seem to be a standard access log that goaccess primarily operates with. Please provide details about the fields you intend to extract.