Support Questions

Find answers, ask questions, and share your expertise
Announcements
Celebrating as our community reaches 100,000 members! Thank you!

Sqoop logging when invoked via CLI

avatar

Sqoop today does not seem to provide any option to specify location to save the logs when invokes from the CLI: it always prints details on the console.

Is there a way to capture Sqoop output in a file? If not any plans for this?

1 ACCEPTED SOLUTION

avatar
Master Mentor

you can try something like this

sqoop command 2>&1| tee -a log

View solution in original post

6 REPLIES 6

avatar
Master Mentor

you can try something like this

sqoop command 2>&1| tee -a log

avatar

I tried this once and didn't work. let me know it works for you.

avatar
Master Mentor

@Guilherme Braccialli I tried this ..I do see log

-rw-r--r--. 1 root root 4573 Dec 12 05:13 log

[root@phdns01 ~]# sqoop import --connect jdbc:mysql://localhost:3306/test --username root --password root --table t1 --hive-import --direct --hive-table t1 2>&1| tee -a log

avatar
Master Mentor

I use the same trick with mapreduce jobs, hive -f commands, etc, it's proven to work guys. @Ali Bajwa @Guilherme Braccialli

avatar
Rising Star

if you also want your sqoop command included you can expend the command like this (with set -x and set +x:

{
echo $(date) 
set -x
beeline -u ${hive2jdbcZooKeeperUrl} -f "file.hql"
set +x
echo $(date)
} 2>&1 | tee /tmp/sqoop.log

avatar
New Contributor

Yes. you just need suffix this "2>&1| tee -a sqooptest.log" along with your SQOOP EXPORT/IMPORT command