@T West Within the logic app you can use inline code and write javascript code to get the digit part of your filename. For testing purposes, I have defined the filename to the var text. But you can use the workflowContext object to get the fileName as mentioned in the inline code document.
var text = "1244_test";
var digit= text.split('_')[0];
return digit;
Updated:
You can also use split if you don't have complex logic.