How can I print DNS cache from SSH with full addresses?

Hi,

I’m trying to develop a bash script that obtains the /ip dns cache print result and parses the content, but RouterOS doesn’t provide me the full addresses when I do this command from SSH:


ktk@ktk8:/tmp$ ssh admin@router /ip dns cache print | fgrep akamai
admin@router’s password:
88 n0g.akamai… 200.160.195.206 2h32m13s
89 n1g.akamai… 200.160.195.206 5h32m13s
90 n2g.akamai… 201.55.233.14 8h32m13s
91 n3g.akamai… 200.160.195.206 2h32m13s
92 n4g.akamai… 200.204.102.142 5h32m13s
93 n5g.akamai… 201.55.233.22 8h32m12s
94 n6g.akamai… 201.82.108.14 2h32m13s
95 n7g.akamai… 201.82.108.12 5h32m13s
98 n0c.akamai… 200.216.8.61 2h32m13s
99 n3c.akamai… 201.6.5.17 2h32m13s
100 n6c.akamai… 177.43.198.11 2h32m13s
121 n0b.akamai… 200.182.35.151 2h36m40s
122 n1b.akamai… 201.82.108.12 5h36m40s
123 n2b.akamai… 200.182.35.148 8h36m40s
124 n3b.akamai… 193.108.88.193 2h36m40s
125 n4b.akamai… 201.82.108.12 5h36m40s
126 n5b.akamai… 200.182.35.150 8h36m40s
127 n6b.akamai… 200.182.35.149 2h36m40s
128 n7b.akamai… 200.182.35.150 5h36m40s
129 n7x.akamai… 201.82.108.12 56m10s
ktk@ktk8:/tmp$


How can I obtain the full addresses (without the ‘…’) through SSH?

Hi there.

Technically what you’re seeing is correct :frowning: Since you’re not opening a full terminal window on the RouterOS box Mikrotik makes some sane assumptions as to your screen width. IT then concatenates (…) the text to fit that width.

The easiest fix for you is to use the following:
ssh admin@router /ip dns cache print detail | fgrep akamai

This should give you the full name - tho you’d likely then have to further sed the output.

Hope this helps