Support Questions
Find answers, ask questions, and share your expertise
Announcements
Alert: Welcome to the Unified Cloudera Community. Former HCC members be sure to read and learn how to activate your account here.

Sqoop logging when invoked via CLI

Solved Go to solution
Highlighted

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

Accepted Solutions
Highlighted

Re: Sqoop logging when invoked via CLI

Mentor

you can try something like this

sqoop command 2>&1| tee -a log

View solution in original post

6 REPLIES 6
Highlighted

Re: Sqoop logging when invoked via CLI

Mentor

you can try something like this

sqoop command 2>&1| tee -a log

View solution in original post

Highlighted

Re: Sqoop logging when invoked via CLI

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

Highlighted

Re: Sqoop logging when invoked via CLI

@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

Highlighted

Re: Sqoop logging when invoked via CLI

Mentor

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

Re: Sqoop logging when invoked via CLI

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

Highlighted

Re: Sqoop logging when invoked via CLI

New Contributor

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

Don't have an account?
Coming from Hortonworks? Activate your account here