How can we get the jenkins console output in a text file?
if you want just access the log and download it as a txt file to your workspace from the job's URL:

${BUILD_URL}/consoleText


On Linux, you can use wget to download it to your workspace

wget ${BUILD_URL}/consoleText


The actual log file on the file system is in the Master machine. You can find it under:

$JENKINS_HOME/jobs/$JOB_NAME/builds/lastSuccessfulBuild/log