How to Export Data from AWS Elasticsearch Domain into a CSV File - amazon-elasticsearch

I would like to know how to export indices from AWS Elasticsearch Domain into CSV files.
I appreciate any advise.

Please have a look at https://github.com/taraslayshchuk/es2csv.
You could do something like
es2csv -u https://your-aws-domain.region.es.amazonaws.com -i your_index_name -o csv_file.csv -r -q '{"query" : {"match_all" : {}}}'
Hope that helps.

Related

Uploading local file to GraphDB

Tried the following curl command for uploading a local turtle file to GraphDB (free version), running at http://localhost:7200/.
curl -X POST 'http://localhost:7200/repositories/testrepository1/statements' -H "Content-Type:text/turtle" -T "/home/Desktop/onto.ttl"
Eventhough this curl command doesn't return any error when executed, the local file onto.ttl is not uploaded to testrepository1
Iam using graphDB free with version 9.7.0.
It'll be grateful if someone help me with this. Thanks in advance!
You are using a wrong mime type - it should be application/x-turtle instead of text/turtle. The request will look something like this:
curl -X POST -H "Content-Type:application/x-turtle" -T "/home/Desktop/onto.ttl" http://localhost:7200/repositories/testrepository1/statements

impala shell command to export a parquet file as a csv

I have some parquet files stored in HDFS that I want to convert to csv files FIRST and export them in a remote file using ssh.
I don't know if it's possible or simple by writing a spark job (I know that we can convert parquet to csv file JUST by using spark.read.parquet then to the same DF use spark.write as a csv file). But I really wanted to do it by using a impala shell request.
So, I thought about something like this :
hdfs dfs -cat my-file.parquet | ssh myserver.com 'cat > /path/to/my-file.csv'
Can you help me PLEASE with this request ? Please.
Thank you !!
Example without kerberos:
impala-shell -i servername:portname -B -q 'select * from table' -o filename '--output_delimiter=\001'
I could explain it all, but it is late and here is a link that allows you to do that as well as the header if you want: http://beginnershadoop.com/2019/10/02/impala-export-to-csv/
You can do that by multiples ways.
One approach could be as in the example below.
With impala-shell you can run a query and pipe to ssh to write the output in a remote machine.
$ impala-shell --quiet --delimited --print_header --output_delimiter=',' -q 'USE fun; SELECT * FROM games' | ssh remoteuser#ip.address.of.remote.machine "cat > /home/..../query.csv"
This command change from default database to a fun database and run a query on it.
You can change the --output_delimiter='\t', --print_header or not along with other options.

Open PDF found with volatility

my task is to analyze a memory dump. I've found the location of a PDF-File and I want to analyze it with virustotal. But I can't figure out how to "download" it from the memory dump.
I've already tried it with this command:
python vol.py -f img.vmem dumpfiles -r pdf$ -i --name -D dumpfiles/
But in my dumpfile-directory there is just a .vacb file which is not a valid pdf.
I think you may have missed a command line argumenet from your command:
python vol.py -f img.vmem dumpfiles -r pdf$ -i --name -D dumpfiles/
If you are not getting a .dat file in your output folder you can add -u:
-u, --unsafe Relax safety constraints for more data
Can't test this with out access to the dump but you should be able to rename the .dat file created to .pdf.
So it should look something like this:
python vol.py -f img.vmem dumpfiles -r pdf$ -i --name -D dumpfiles/ -u
You can check out the documentation on the commands here
VACB is "virtual address control block". Your output type seems to be wrong.
Try something like:
$ python vol.py -f img.vmem dumpfiles --output=pdf --output-file=bla.pdf --profile=[your profile] -D dumpfiles/
or check out the cheat sheet: here

mysqldump. Location of the file?

I did an update on my db, but can't find the file so I can download it. Where is the file located at? Thanks in advance
root#xxxx:~# mysqldump -u root -p cherio > myBackup.sql
Enter password:
root#xxxx:~# find myBackup.sql
myBackup.sql
EDIT:
I tried this:
root#xxxx:~# find / -name "myBackup.sql"
/root/myBackup.sql
Ok, I had to refresh my FTP for the file to show up.
On the same directory you made the dump. It's ./myBackup.sql and not myBackup.sql
Do an ls -all.
It is in the same directory where you ran this command. To check this, run "pwd", it will give you your current path. Then run the command and it will store the database file in the same directory.
To get generated file properly run following command,
mysqldump --database --user=root --password your_db_name > export_into_db.sql
This will give you the "export_into_db.sql" database file.
Play with it.
Enjoy...
It is at either at root or in current directory where you run the dump command.
try this command on terminal..
locate myBackup.sql
I had the same problem.
It comes out that for some reason I could not create any file at root directory.
Try to go into some deeper folder
For example
cd var
cd www
and than execute:
mysqldump -uUSERNAME -pPASSWORD DATABASE > backup.sql

How can I export data from SimpleDB to Excel or TextPad?

I want to export data from SimpleDB to Excel or TextPad. How can I write a query for exporting data?
Thanks,
Senthil
You can use SDB Explorer to export the data into a CSV file, which you can open with your favorite editor.
Sdbport is a Ruby Gem that can export / import SimpleDB domains. It works across accounts and regions. It can be used as a class or stand alone CLI.
On a system with Ruby intalled (tested with 1.9.3p125):
Install sdbport:
gem install sdbport
Set your AWS credentials:
export AWS_ACCESS_KEY_ID=your_aws_key
export AWS_SECRET_ACCESS_KEY=your_aws_secret
Export SimpleDB domain from us-west-1:
sdbport export -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -r us-west-1 -n data -o /tmp/test-domain-dump
Import into domain in us-east-1
sdbport import -a $AWS_ACCESS_KEY_ID -s $AWS_SECRET_ACCESS_KEY -r us-west-1 -n data -i /tmp/test-domain-dump
You can Export your content of domain in XML using SDB Explorer.
For more details please refer our documentation page and for watch video.
Disclosure: I'm a developer of SDB Explorer.