Given the following configuration:
input {
exec {
command => "python3 ${LOGSTASH_HOME}/script/firmware/backend/download_script.py"
schedule => "${SCHEDULER}"
type => "Backend"
}
exec {
command => "python2 ${LOGSTASH_HOME}/script/firmware/error_parser/parsers/log_parser/parser.py -pp true -lf ${LOGSTASH_HOME}/firmware_data"
schedule => "${FIRMWARE_SCHEDULER}"
type => "Firmware"
}
file {
path => "${LOGSTASH_HOME}/firmware_data/errorcode_diagnostics/*.diag"
codec => json
start_position => "beginning"
sincedb_path => "${LOGSTASH_HOME}/file/.sincedb*"
type => "S3"
}
}
Question:
Is there any way I can tell the exec input plugin to wait until command => "python3 ${LOGSTASH_HOME}/script/..."
is done before it starts executing command => "python2 ${LOGSTASH_HOME}/script/firmware/error_parser/..."
?
Note: The second exec command requires the first exec command to be finished first!
Possible solution 1: Set the time interval for the second command anywhere from 5-10m after the first command to ensure it is processed successfully before it starts.
Problem: This approach can sometimes fail if there is a lot of data being processed by the first command, so while the first command is still in process, the second command can kick in and fail.
Possible solution 2: Run the second command in the filter plugin.
Problem: This approach doesn't generate any extra fields to use after in the filter plugin or output plugin, only running the script in the input plugin does this.