diff --git a/.gitignore b/.gitignore index c938d89..29ae30e 100644 --- a/.gitignore +++ b/.gitignore @@ -2,4 +2,5 @@ config.yaml .vscode/ vendor/ *.log -*.tar.gz \ No newline at end of file +*.tar.gz +*.bak \ No newline at end of file diff --git a/config.go b/config.go index 8cb380d..96a3564 100644 --- a/config.go +++ b/config.go @@ -11,6 +11,7 @@ type Configuration struct { Password string Port int Hosts []string + Logs []string } func initializeConfig(filename string) Configuration { diff --git a/generate.go b/generate.go index fb8083e..c6e7ec9 100644 --- a/generate.go +++ b/generate.go @@ -1,5 +1,52 @@ package main -// this file is for generating the config if it doesn't exist +import ( + "fmt" + "io/ioutil" + "os" + + "gopkg.in/yaml.v2" +) + +// this file is for generating the config if it doesn't exist, mainly for the idiots like me :) // this is not really a priority right now so it sitting in the backburner as you read this // signed Wyatt J. Miller, the awesome guy who doesn't generate configs *thumbs up* + +var config string = "config.yaml" + +func doesConfigExist() bool { + _, err := os.Stat(config) + + if err != nil { + return false + } else { + return true + } +} + +func createTemplateConfig(result bool) { + if result == false { + os.Create(config) + } else { + fmt.Println() + } +} + +func writeTemplateConfig(filename string) { + file := []byte(filename) + _ = ioutil.WriteFile("config.yaml", file, 0600) + + config := Configuration{} + + _, err := yaml.Marshal(config) + + if err != nil { + panic(err) + } + + fmt.Println("Template for logman's configuration complete!") + fmt.Println("") + fmt.Println("Fill in the necessary credentials you need. If") + fmt.Println("you need assitance, check out the wiki for more.") + os.Exit(0) +} diff --git a/todo.md b/todo.md new file mode 100644 index 0000000..4fa229e --- /dev/null +++ b/todo.md @@ -0,0 +1,6 @@ +## Things I got to do for the project +- Have config file dictate what log file you want +- Allow having SSH keys and passwordless SSH sessions, along with having bypassing keys altogether +- Allow fetching of multiple log files (fields under the defined host? Seperate key/field? Dynamic?) +- Allow different machines to collect different log files +- Allow to gather directories of log files \ No newline at end of file