Support Questions

Find answers, ask questions, and share your expertise
Announcements
Check out our newest addition to the community, the Cloudera Data Analytics (CDA) group hub.

Sqoop logging when invoked via CLI

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

Mentor

you can try something like this

sqoop command 2>&1| tee -a log

View solution in original post

6 REPLIES 6

Mentor

you can try something like this

sqoop command 2>&1| tee -a log

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

@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

Mentor

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

Contributor

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

New Contributor

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

Take a Tour of the Community
Don't have an account?
Your experience may be limited. Sign in to explore more.