buffer truncated in expect script
<p>I am trying to use expect script for collecting information from a remote server. for logging purpose, i am suppressing the output on the screen and redirecting it to a file in the local server. Here is the script i used. this is storing the output in the local file, however the log is truncated.</p>

<pre><code>#!/usr/bin/expect
log_user 0
set password [lindex $argv 0]
set user [lindex $argv 1]
set host [lindex $argv 2]
set timeout -1
set file "/tmp/b"
set fp [open "/tmp/gather_info" r]
set data [read $fp]
spawn ssh $user@$host
expect "*?assword:*"
send "$password\r"
expect "*$*"
send "su - oracle\r"
expect "*oracle*"
send "$data\r"
expect {
    "end_expect" exit
}
expect eof
match_max 10000
puts $file $expect_out(buffer)
</code></pre>

<p>I tried to use match_max just after expect also. even that could not help me. Any suggestion in this regard is of great help to me.
Thank you very much for going though this question.</p>