FortiSOAR Discussions
ereta
New Contributor II

Uploading/Extract text from txt file

Hello All!

 

I'm attempting to read a txt file after uploading it to "Attachments". I'm using the connector "File Content Extraction" to get the contents of the file and I'm inserting the IRI value using the IRI Lookup Function (second screnshot), but I still am getting a "No such file or directory" error (third screenshot).

 

I've already tried to re-upload it a couple of times, I get the same result.

 

I'd highly appreciate any guidance on how to solve this issue.

 

Thanks!attachment.pngconnector_config.pngerror.png

5 REPLIES 5
doubleohseven
New Contributor II

Not entirely sure what the issue is here but I can see in your first screenshot under the "File" key that it says <RECORD NOT FOUND>, so you're passing that through the playbook. I would start there and investigate why it says that.

Jtamboli
Staff
Staff

Hello ereta,
I will help you with the steps using which you can read your text file data.
Steps:
1. Create a Manual trigger step
2. Select the attachment or indicator module (as shown in screenshot 1)
3. Add action step "Extract Text From File"
4. In File IRI/Path input parameter pass the IRI of the file like,
{{vars.input.records[0].file['@id']}}
(as shown in screenshot 2)
5. Execute the playbook from the attachment module (as shown in Screenshot 04)
6. Screenshot 3 shows the final output.

Hope this help you..!!!

Thank you
Junaid Tamboli

Junaid
ereta
New Contributor II

Hello Jtamboli!

 

Thanks for the information, I've followed the steps but I get the "Error Parsing the File: list index out of range" Connector error, I've attached the screenshots showing the config of each step and also the output error I get; I'd appreciate any further guidance.

 

The txt file contains the following:

user1
user2
user3

 

 

attachment.pngconnector_config.pngerror.png

Thanks!:D

 

dspille
Staff
Staff

 
 

Hey @ereta , the issue you're encountering here is due to fact that Attachment records are different than File records in FortiSOAR. Attachments is module that uses the Files module for storing files. The action you're using is asking for the File @id/IRI , but you're giving it the Attachment @id/IRI . What you first need to do is query the attachment record using a find record step, which will return the attachment record and it's file @id. You can then use the file @id in the "Extract Text" action

I'm attaching a sample playbook that gets the text from an attachment two different ways

Extract_Text_Playbook.png

Dylan Spille
ereta
New Contributor II

Hey Dylan!

 

Thanks for the sample playbook! It indeed is able to get the file by Name, but when I try by UUID, it is not able to. I'm wondering why this is happening, as I've made sure that it doesn't contains blank spaces and as you can see in the input of the "Get attachment by UUID", it is indeed getting the same UUID as the one that was set in the "Set Vars" step.

 

 

input.png

 

Set_vars.png

 

uuid.png