This is a tool that functions to convert log files in the linux /var/log folder into text files or JSON files.
These tools are made using the Golang programming language and use the Cobra library as a library to create CLI Applications.
If you to use this tools, please follow this steps:
- Clone this repository
- Run
go mod tidy
and make sure that you activated go modules first - Install this application with
go install mytools
- Read and follow the description with running
mytools -h
Run this command to convert the log files into PlainText or JSON: mytools [path of log files] [flag of type] [type convert]
- To convert log files into PlainText, e.g.
mytools /var/log/nginx/error.log -t text
- To convert log files into JSON, e.g.
mytools /var/log/nginx/error.log -t json
- If flags of type is not included, it will be converted into PlainText file by default, e.g.
mytools /var/log/nginx/error.log
You can also export the converted files into PlainText or JSON file.
Run this command to exported the files: mytools [path of log files] [flag of type] [type convert] [flag of output] [output destination]
- To export from log files into PlainText, e.g.
mytools /var/log/nginx/error.log -t text -o /Users/JohnDoe/Desktop/nginxlog.txt
- To export from log files into JSON, e.g.
mytools /var/log/nginx/error.log -t json -o /Users/JohnDoe/Desktop/nginxlog.json
- If flag of type file is not included, it will be convert PlainText by default, e.g.
mytools /var/log/nginx/error.log -o /Users/JohnDoe/Desktop/nginxlog.txt