Advertisement
Guest User

Untitled

a guest
Jan 21st, 2017
113
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Go 0.49 KB | None | 0 0
  1. log_format := ^([^ ]+) (-) (-) \[([^\]]+)\] "([^\"]+?)" ([0-9]+) ([^ ]+) "([^"])*" "([^"]*)"
  2. logParser := regexp.MustCompilePOSIX(log_format)
  3. log_format_get := ^(GET|HEAD|POST) (.+) (HTTP.+)$
  4. logParserGet := regexp.MustCompilePOSIX(log_format_get)
  5. ...
  6. analize1 := func (iline *string) {
  7. submatch := logParser.FindSubmatch(strings.TrimSpace(*iline))
  8. if (len(submatch[0])>0){
  9. pg := logParserGet.FindAllStringSubmatch(strings.TrimSpace(submatch[0][5]), 1)
  10. if (len(pg)>0){
  11. hash[pg[0][2]]++
  12. }
  13. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement