September 2017
Intermediate to advanced
466 pages
9h 33m
English
The example of this section will improve the functionality of the countIP.go utility, by developing a program that automatically detects the field with the IP address; therefore, it will not require the user to define the field of each log entry that contains the IP address. To make things simpler, the created program will only process the first IP address of each line: findIP.go takes a single command-line argument, which is the name of the log file you want to process. The program will be presented in four parts.
The first part of findIP.go is the following:
package main import ( "bufio" "fmt" "io" "net" "os" "path/filepath" "regexp" )
The second part is where most of the magic happens with the help of ...
Read now
Unlock full access