How to download logs from openrpa_instances collection?

Hi Allen,

Could you please help me to download workflow logs from openrpa_instances collection.
Thnak you.

Please dont create multiple threads about the same thing. Also, please explain what you are trying to do. i have alread answered multiple times, so please explain what you are trying to do, for me to help you find the right solution.

My bad. I am sorry for making things messy. I am understanding things slowly.
As you explaned early, now I can view logs in openrpa_instances collection with out any issue.
only now I was able to do it. what I want is down the same logs. Previously you have shared me some details with me. But I was not able to undestand it. so if it is possible kindly explain it to me once more.

Why do you want to download it? It is already stored in a database you can query on, and you can access it from the web interface. So what are you trying to archeive?

Hi Allen,

Sorry for delay to replay.
My Client wants to get download them to CSV format to analyze it.
That is the requirement of mine.
I kindly requesting a help because I have stuck here.
Thanks and have a nice day ahead.

Why can you not use mongodb for that ?

you could try something like this

import csv, openiap, asyncio
from openiap import Client
async def onconnected(cli:Client):
        pageby = 100
        await cli.Signin()
        print("Connected to OpenIAP") 
        to_csv = await cli.Query(collectionname="audit", top=pageby, projection={"_created": 1, "success": 1, "_type": 1, "_id": 0})
        pagecounter = 1
        skip = 0
        keys = list(to_csv[0].keys())
        with open('logs.csv', 'w', newline='') as output_file:
            dict_writer = csv.DictWriter(output_file, keys)
            while len(to_csv) == pageby and pagecounter < 5:
                skip += pageby
                pagecounter += 1
                to_csv = await cli.Query(collectionname="audit", top=pageby, skip=skip, projection={"_created": 1, "success": 1, "_type": 1, "_id": 0})
    except Exception as e:
async def main():
    client = openiap.Client("grpc://")
    client.onconnected = onconnected
    await asyncio.sleep(2)
    while client.connected:
        await asyncio.sleep(1)

Hi Allen,

I tried to compile this code but it generates errors like below.

Hi Allen,

If it is possible kindly share with me plain NodeJS script to connect to back end mongodb and execute select all query. Then form their i can debug the rest.
Thank you.

Hi Allen,

I am using my gmail address to connect to my openflow.
So what should be the password in above feild.
Thank you.

This is so hard to execute . No modules find always and so on. Errors only

Install openflow on premise or in your own cloud.

And then add

      - "27017:27017"

to the mongodb service.
Then you can do what ever you want with the database

Hi Allen,

All the errors I came up with code is fixed now. Happy to see it. I am using Gmail to login to my openflow account. I have put my email to username section and kept password empty is it all ok? Kindly help. Thank you.

This is the message I am getting

No, you need to set a password for your user, by clicking your username in openflow and filling out the password field

Hi Allen,

update here. I set the password.
But it stand still like below.
What would be the case here?

No Allen same error again. grpc status code 2

Try to change the line

to_csv = await cli.Query(collectionname="audit", top=pageby, skip=pageby, projection={"_created": 1, "success": 1, "_type": 1, "_id": 0})


to_csv = await cli.Query(collectionname="audit", top=pageby, skip=skip, projection={"_created": 1, "success": 1, "_type": 1, "_id": 0})

Then perhaps it will finish.

1 Like

Changed it and tried.
No luck bro…

Now its like below.

Thanks for noticing, I have edit’ed the script above