MCPcopy Create free account
hub / github.com/github/gh-aw / parseSquidLogLine

Function parseSquidLogLine

pkg/cli/access_log.go:136–154  ·  view source on GitHub ↗

parseSquidLogLine parses a single squid access log line Squid log format: timestamp duration client status size method url user hierarchy type

(line string)

Source from the content-addressed store, hash-verified

134// parseSquidLogLine parses a single squid access log line
135// Squid log format: timestamp duration client status size method url user hierarchy type
136func parseSquidLogLine(line string) (*AccessLogEntry, error) {
137 fields := strings.Fields(line)
138 if len(fields) < 10 {
139 return nil, fmt.Errorf("invalid log line format: expected at least 10 fields, got %d", len(fields))
140 }
141
142 return &AccessLogEntry{
143 Timestamp: fields[0],
144 Duration: fields[1],
145 ClientIP: fields[2],
146 Status: fields[3],
147 Size: fields[4],
148 Method: fields[5],
149 URL: fields[6],
150 User: fields[7],
151 Hierarchy: fields[8],
152 Type: fields[9],
153 }, nil
154}
155
156// analyzeAccessLogs analyzes access logs in a run directory
157func analyzeAccessLogs(runDir string, verbose bool) (*DomainAnalysis, error) {

Callers 2

TestParseSquidLogLineFunction · 0.85
parseSquidAccessLogFunction · 0.85

Calls 1

ErrorfMethod · 0.45

Tested by 1

TestParseSquidLogLineFunction · 0.68