Skip to content

lgc init

The lgc init command initialize LogCraft CLI configuration by creating the configuration file lgc.yaml and the rules directory, the source of detection rules.

Home Sweet $HOME

lgc init creates files and folders where you are, so cd to the appropriate working directory prior executing lgc init, or make sure to use the --path option.

bash
~$ pwd
/Users/bwayne
~$ lgc init
LogCraft configuration initialized in /Users/bwayne
~$

The command also admits an extra parameter to specify the path to where the configuration should be created:

bash
~$ lgc init --path /foo/bar
LogCraft configuration initialized in /foo/bar
~$ ls -1 /foo/bar
rules
lgc.yaml
~$

WARNING

When passing a path, lgc will create all the directories tree.

If there is a pre-existing lgc.yaml file in the target folder, lgc will fail as shown hereafter:

bash
~$ lgc init 
ERROR `lgc.yaml` already exists in `/Users/bwayne`
~$

Manually resolve the situation by deleting or moving the pre-existing lgc.yaml file.

Similarely, if the rules folder already exists, you will only get a warning and the existing rules folder won't be modified.

bash
~$ lgc init 
 WARN rules folder already exists in `/Users/bwayne`
~$