<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: how to clean up /var/adm/wtmp and btmp log files in Operating System - HP-UX</title>
    <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880988#M100880</link>
    <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can place these in cron, or do them from the command line.&lt;BR /&gt;&lt;BR /&gt;0 22 1 * * cat /var/adm/wtmp | /usr/sbin/acct/fwtmp &amp;gt; /tmp/ascii_wtmp &lt;BR /&gt;5 22 1 * * cat /tmp/ascii_wtmp | /usr/sbin/acct/fwtmp &amp;gt; /var/adm/wtmp &lt;BR /&gt;&lt;BR /&gt;Have a look at the man page for 'fwtmp'&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# cat /dev/null &amp;gt; /var/adm/wtmp &lt;BR /&gt;# cat /dev/null &amp;gt; /var/adm/btmp &lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Michael&lt;BR /&gt;&lt;BR /&gt;</description>
    <pubDate>Tue, 14 Jan 2003 03:07:30 GMT</pubDate>
    <dc:creator>Michael Tully</dc:creator>
    <dc:date>2003-01-14T03:07:30Z</dc:date>
    <item>
      <title>how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880986#M100878</link>
      <description>Hi folks,&lt;BR /&gt;&lt;BR /&gt;My system is having a large file size for /var/adm/wtmp and /var/adm/btmp. As these are keeping records for login information, can I just empty the data content? &lt;BR /&gt;&lt;BR /&gt;Any better commands on automation?&lt;BR /&gt;&lt;BR /&gt;thanks in advance</description>
      <pubDate>Tue, 14 Jan 2003 02:57:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880986#M100878</guid>
      <dc:creator>Yan Wong</dc:creator>
      <dc:date>2003-01-14T02:57:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880987#M100879</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can just null out those files like this:&lt;BR /&gt;&lt;BR /&gt;cat /dev/null &amp;gt;/var/adm/wtmp&lt;BR /&gt;cat /dev/null &amp;gt;/var/adm/btmp&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Here is a thread that talks about pruning the files, saving the information, and also automating the task:&lt;BR /&gt;&lt;BR /&gt;&lt;A href="http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xb9855220af9bd5118ff10090279cd0f9,00.html" target="_blank"&gt;http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0xb9855220af9bd5118ff10090279cd0f9,00.html&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;JP&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jan 2003 03:04:14 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880987#M100879</guid>
      <dc:creator>John Poff</dc:creator>
      <dc:date>2003-01-14T03:04:14Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880988#M100880</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;You can place these in cron, or do them from the command line.&lt;BR /&gt;&lt;BR /&gt;0 22 1 * * cat /var/adm/wtmp | /usr/sbin/acct/fwtmp &amp;gt; /tmp/ascii_wtmp &lt;BR /&gt;5 22 1 * * cat /tmp/ascii_wtmp | /usr/sbin/acct/fwtmp &amp;gt; /var/adm/wtmp &lt;BR /&gt;&lt;BR /&gt;Have a look at the man page for 'fwtmp'&lt;BR /&gt;&lt;BR /&gt;or&lt;BR /&gt;&lt;BR /&gt;# cat /dev/null &amp;gt; /var/adm/wtmp &lt;BR /&gt;# cat /dev/null &amp;gt; /var/adm/btmp &lt;BR /&gt;&lt;BR /&gt;HTH&lt;BR /&gt;Michael&lt;BR /&gt;&lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jan 2003 03:07:30 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880988#M100880</guid>
      <dc:creator>Michael Tully</dc:creator>
      <dc:date>2003-01-14T03:07:30Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880989#M100881</link>
      <description>You can zero out the files but since they contain information about past, current and failed logins, you may want to scan them for abnormalities. The tools are last (for wtmp) and lastb (for btmp). Excessive failures to login (especially root) could be a security problem.&lt;BR /&gt;&lt;BR /&gt;Once you scan (and extract) for useful info, you can zero out the files (they are binary so vi and ASCII tools won't work). Note that wtmp amd btmp are only good for one year as they do not have the year stored. If these files have data longer than one year, there will appear to be ghost sessions present.</description>
      <pubDate>Tue, 14 Jan 2003 03:15:46 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880989#M100881</guid>
      <dc:creator>Bill Hassell</dc:creator>
      <dc:date>2003-01-14T03:15:46Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880990#M100882</link>
      <description>Hi:&lt;BR /&gt;&lt;BR /&gt;If for any reason you do not wish to log either successful logins ('/var/adm/wtmp') or unsuccessful ones (in 'var/adm/btmp') then remove the file(s).&lt;BR /&gt;&lt;BR /&gt;The absence of a the file disables the corresponding logging.  To re-enable the capture, recreate (touch) the appropriate file(s).&lt;BR /&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;&lt;BR /&gt;...JRF...</description>
      <pubDate>Tue, 14 Jan 2003 03:23:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880990#M100882</guid>
      <dc:creator>James R. Ferguson</dc:creator>
      <dc:date>2003-01-14T03:23:18Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880991#M100883</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;you no need to empty the files , you just have to trim it down&lt;BR /&gt;&lt;BR /&gt;# &amp;gt; /var/adm/wtmp&lt;BR /&gt;&lt;BR /&gt;# &amp;gt; /var/adm/btmp&lt;BR /&gt;&lt;BR /&gt;or &lt;BR /&gt;&lt;BR /&gt;you can use sam &lt;BR /&gt;&lt;BR /&gt;Routine Tasks -&amp;gt; System Log Files -&amp;gt; /var/adm/btmp and /var/adm/wtmp&lt;BR /&gt;&lt;BR /&gt;here you can also trim other log files.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Thanks &amp;amp; regards&lt;BR /&gt;Sri</description>
      <pubDate>Tue, 14 Jan 2003 03:30:04 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880991#M100883</guid>
      <dc:creator>Sritharan</dc:creator>
      <dc:date>2003-01-14T03:30:04Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880992#M100884</link>
      <description>You can null this files, but from practice i have seen its better to preserve these files for few weeks.&lt;BR /&gt;Best is to write a housekeeping script put it in the cron, which copies these files to some date stamp like btmp.14Jan2002 and then make them zero&lt;BR /&gt;&amp;gt; btmp&lt;BR /&gt;Also search for old files and keep deleting them.&lt;BR /&gt;&lt;BR /&gt;Cheers&lt;BR /&gt;Rajeev</description>
      <pubDate>Tue, 14 Jan 2003 03:34:05 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880992#M100884</guid>
      <dc:creator>Rajeev  Shukla</dc:creator>
      <dc:date>2003-01-14T03:34:05Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880993#M100885</link>
      <description>&lt;A href="http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000062904760" target="_blank"&gt;http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000062904760&lt;/A&gt;&lt;BR /&gt;&lt;A href="http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000062908330" target="_blank"&gt;http://www2.itrc.hp.com/service/cki/docDisplay.do?docLocale=en_US&amp;amp;docId=200000062908330&lt;/A&gt;</description>
      <pubDate>Tue, 14 Jan 2003 05:03:47 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880993#M100885</guid>
      <dc:creator>T G Manikandan</dc:creator>
      <dc:date>2003-01-14T05:03:47Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880994#M100886</link>
      <description>Hi,&lt;BR /&gt;&lt;BR /&gt;Yes you can empty the file.&lt;BR /&gt;&lt;BR /&gt;to automate it you can place the command in crontab file to clean the files weekly or monthly.</description>
      <pubDate>Tue, 14 Jan 2003 06:07:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880994#M100886</guid>
      <dc:creator>Ravi_8</dc:creator>
      <dc:date>2003-01-14T06:07:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880995#M100887</link>
      <description>Hi &lt;BR /&gt;&lt;BR /&gt;you can clean them up with command line : &lt;BR /&gt;cat /dev/null &amp;gt;/var/adm/wtmp &lt;BR /&gt;cat /dev/null &amp;gt;/var/adm/btmp &lt;BR /&gt;&lt;BR /&gt;SAM : &lt;BR /&gt;&lt;BR /&gt;or you can go to SAM -&amp;gt; routine Task -&amp;gt; systel log files .&lt;BR /&gt;&lt;BR /&gt;over there you can choose to trim any system log file that you want . &lt;BR /&gt;</description>
      <pubDate>Tue, 14 Jan 2003 09:16:27 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/2880995#M100887</guid>
      <dc:creator>eran maor</dc:creator>
      <dc:date>2003-01-14T09:16:27Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6956851#M490100</link>
      <description>&lt;P&gt;I'm familiar with the binary to ascii conversion (&lt;SPAN&gt;/var/adm/wtmp | /usr/sbin/acct/fwtmp)&lt;/SPAN&gt; with tail to shrink the accounting files.&amp;nbsp;What does '$&amp;nbsp;&lt;SPAN&gt;# &amp;gt; /var/adm/wtmp'&lt;/SPAN&gt; actually do? Does it perform that conversion and shrink it to a set number&amp;nbsp;of lines?&lt;/P&gt;</description>
      <pubDate>Fri, 14 Apr 2017 18:52:54 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6956851#M490100</guid>
      <dc:creator>bgwest</dc:creator>
      <dc:date>2017-04-14T18:52:54Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6956915#M490101</link>
      <description>&lt;P&gt;&amp;gt;What does '&lt;SPAN&gt;# &amp;gt; /var/adm/wtmp'&lt;/SPAN&gt; actually do?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Sets EOF to zero.&lt;/P&gt;</description>
      <pubDate>Sat, 15 Apr 2017 21:55:11 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6956915#M490101</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2017-04-15T21:55:11Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6957103#M490103</link>
      <description>&lt;P&gt;Dennis,&lt;BR /&gt;&lt;BR /&gt;Thanks for the quick reply. Want to make sure I am understanding that correctly. Here are the results of use of this on ascii text file. Does it need to be binary for it to work?&amp;nbsp;Can you point me to the correct man page?&lt;/P&gt;&lt;PRE&gt;+server$ vi trtest.txt
"trtest.txt" [New file]
is the end of file 0 now?
yes?
no?
checking
testing
checking
test...
~
(...)
"trtest.txt" [New file] 7 lines, 69 characters
+server$
+server$ awk '{print NR}' trtest.txt
1
2
3
4
5
6
7
+server$
+server$ # &amp;gt; trtest.txt
+server$ awk '{print NR}' trtest.txt
1
2
3
4
5
6
7
+server$ # &amp;gt; trtest.txt
+server$ awk 'END{print NR}' trtest.txt
7
+server$ file trtest.txt
trtest.txt:     ascii text
+server$&lt;/PRE&gt;&lt;P&gt;Thank you again,&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 16:09:51 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6957103#M490103</guid>
      <dc:creator>bgwest</dc:creator>
      <dc:date>2017-04-17T16:09:51Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6957117#M490104</link>
      <description>&lt;P&gt;&amp;gt; +server$ # &amp;gt; trtest.txt&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;That "#" was an indication of root's prompt.&amp;nbsp; In your use, remove it, otherwise it's a comment.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 17:50:58 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6957117#M490104</guid>
      <dc:creator>Dennis Handly</dc:creator>
      <dc:date>2017-04-17T17:50:58Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6957118#M490105</link>
      <description>&lt;P&gt;Silly misinterpretation on my end.&amp;nbsp;Thanks for the clarification.&lt;/P&gt;</description>
      <pubDate>Mon, 17 Apr 2017 18:02:53 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/6957118#M490105</guid>
      <dc:creator>bgwest</dc:creator>
      <dc:date>2017-04-17T18:02:53Z</dc:date>
    </item>
    <item>
      <title>Re: how to clean up /var/adm/wtmp and btmp log files</title>
      <link>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/7007875#M490837</link>
      <description>&lt;P&gt;This year we ran into issues again with slow logins. This time I wrote a script to handle this every 6-months.&amp;nbsp;&lt;/P&gt;&lt;PRE&gt;#!/usr/local/bin/bash
# wtmps / btmps - 6 month backup and trimming routine
# bgw 05/2018
#

liveFilesDir="/var/adm"
# fwtmp, wtmpfix - manipulate connect accounting records
ftwmpCmd=`/usr/lib/acct/fwtmp`
todaysDate=`date +%m%d%y`
backupDir="/logs_ext/login_files"

[[ ! -d "$backupDir" ]] &amp;amp;&amp;amp;
echo -e "\nBackup dir missing -- creating backup dir @$backupDir" &amp;amp;&amp;amp;
mkdir -p $backupDir

chown root:group $backupDir
chmod 750 $backupDir

# backup file names to write into ASCII format
wtmpFile="wtmp.$todaysDate"
wtmpsFile="wtmps.$todaysDate"
btmpFile="btmp.$todaysDate"
btmpsFile="btmps.$todaysDate"

# save each file records in ASCII format
cd $liveFilesDir
$ftwmpCmd &amp;lt; wtmp &amp;gt; $backupDir/$wtmpFile
$ftwmpCmd &amp;lt; wtmps &amp;gt; $backupDir/$wtmpsFile
$ftwmpCmd &amp;lt; btmp &amp;gt; $backupDir/$btmpFile
$ftwmpCmd &amp;lt; btmps &amp;gt; $backupDir/$btmpsFile

# ensure files are still with original permission state
chown adm:adm wtmp wtmps
chmod 664 wtmp wtmps

chown root:other btmp btmps
chmod 600 btmp btmps

# tar trimmed accounting files
tar -cvf $backupDir/acctfiles.$todaysDate.tar $backupDir/[wb]tmp*.$todaysDate*

# compress accounting files
gzip $backupDir/acctfiles.$todaysDate.tar

# now that we have a backup, null out the files
# I've found keeping records in only one file breaks the 'last' and 'lastb' commands
&amp;gt; wtmp
&amp;gt; wtmps
&amp;gt; btmp
&amp;gt; btmps

# if the ascii version of the files needed to be reverted back to binary
# this command can be used for that
# /usr/lib/acct/fwtmp -ic &amp;lt; /logs_ext/wtmps.05252018.tail100 &amp;gt; wtmps.new&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;I found that from all the suggestions, the best way is to backup and null out both files. Otherwise, the ‘last’ and ‘lastb’ commands break. After running this, both servers have fast logins and our accounting commands are fixed.&lt;BR /&gt;&lt;BR /&gt;Thanks again to everyone’s info! Hopefully this helps someone get quickly on their way someday.&lt;/P&gt;</description>
      <pubDate>Mon, 04 Jun 2018 16:03:18 GMT</pubDate>
      <guid>https://community.hpe.com/t5/operating-system-hp-ux/how-to-clean-up-var-adm-wtmp-and-btmp-log-files/m-p/7007875#M490837</guid>
      <dc:creator>bgwest</dc:creator>
      <dc:date>2018-06-04T16:03:18Z</dc:date>
    </item>
  </channel>
</rss>

