sensu / sensu-check-log

The Sensu Go log file monitoring check plugin and asset.
MIT License
2 stars 3 forks source link

Add 'mkdir -p, --parents' style functionality to --state-directory #40

Open jhenderson-pro opened 1 year ago

jhenderson-pro commented 1 year ago

In internal ref https://secure.helpscout.net/conversation/2175262282/30980?folderId=6397333 it was mentioned it would be helpful to have the functionality to allow creating of parent directory and subdirectory from the check command, for instance:

--state-directory /var/test1/test2

Where the /var/test1 directory does not yet exist, this will currently error out.

asachs01 commented 1 year ago

Could be a sane default of the state directory existing in the asset cache dir? The ideal end user experience is that wouldn't have to worry about setting this attribute at all. $SENSU_LOG_CHECK_PATH/java_log_blah_check.

After discussion, the proposed change is to adding --state-file-name to prevent any possibility of collisions. This would enable users to set the state directory to a directory owned by sensu /var/cache/sensu/sensu-agent and then this directory would contain named state files.

fguimond commented 7 months ago

@jhenderson-pro - We're not sure we understand the solution proposed by Aaron, do you have any more context?

fguimond commented 7 months ago

The current behavior is we create the state directory, but not recursively. After discussions we will go ahead and change the behavior to create the directory recursively (like mkdir -p) instead of just one level deep. The documentation and change logs will also be updated to reflect the change.