How to track my public IP address in a log file?
Clash Royale CLAN TAG#URR8PPP
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
I'd like to save my public IP address to a log file so I can use them to exclude my own visit to my websites in the stats collections.
At the moment I can see my actual public IP address--whatsmyip.org--but I believe that every time I off the modem, it changes.
I don't have a static public IP address, and I think there isn't a fixed range of IP that my ISP is giving me.
I'm running Linux Mint 17.3, is there any way that I've already a similar log file?
If not, can I track my future IPs and how?
networking logs ip
add a comment |
I'd like to save my public IP address to a log file so I can use them to exclude my own visit to my websites in the stats collections.
At the moment I can see my actual public IP address--whatsmyip.org--but I believe that every time I off the modem, it changes.
I don't have a static public IP address, and I think there isn't a fixed range of IP that my ISP is giving me.
I'm running Linux Mint 17.3, is there any way that I've already a similar log file?
If not, can I track my future IPs and how?
networking logs ip
add a comment |
I'd like to save my public IP address to a log file so I can use them to exclude my own visit to my websites in the stats collections.
At the moment I can see my actual public IP address--whatsmyip.org--but I believe that every time I off the modem, it changes.
I don't have a static public IP address, and I think there isn't a fixed range of IP that my ISP is giving me.
I'm running Linux Mint 17.3, is there any way that I've already a similar log file?
If not, can I track my future IPs and how?
networking logs ip
I'd like to save my public IP address to a log file so I can use them to exclude my own visit to my websites in the stats collections.
At the moment I can see my actual public IP address--whatsmyip.org--but I believe that every time I off the modem, it changes.
I don't have a static public IP address, and I think there isn't a fixed range of IP that my ISP is giving me.
I'm running Linux Mint 17.3, is there any way that I've already a similar log file?
If not, can I track my future IPs and how?
networking logs ip
networking logs ip
asked Apr 20 '16 at 3:47
overkill22overkill22
21939
21939
add a comment |
add a comment |
3 Answers
3
active
oldest
votes
This one will give you your public IP, remove /ip
part to see more info.
$ curl ipinfo.io/ip
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
of course, it's not a full solution for you. But with it, you can write your own script, put that script incron
to make it get the IP and save into your log file.
– cuongnv23
Apr 21 '16 at 10:43
add a comment |
You can try to use some dynamic dns services like noip.com
Then You can access resources by dns name, which will changing according to Your ip.
Generally, Your provider may NAT with pool of addresses. And every curl https://ipinfo.io/ip
request will return a random address from this pool, depends on the settings of the NAT.
It's better to use different methods to track visits to web-site. F.e. cookies.
Here is a small python code to put in cron and collect addresses:
#!/usr/bin/env python
from datetime import datetime
import os
import requests
LOG = '/tmp/ip.log'
URL = 'https://ipinfo.io/ip'
r = requests.get(URL)
if r.status_code == 200:
ip = r.content.decode('ascii').rstrip('n')
last_ip = None
if os.path.exists(LOG):
f = open(LOG, 'r')
last_ip = f.readlines()[-1].split()[-1]
f.close()
if ip != last_ip:
f = open(LOG, 'a')
f.write(" n".format(datetime.now(), ip))
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry fromxxx.xxx.xxx.xxx
with his IP address at that time?
– techraf
Apr 20 '16 at 8:32
add a comment |
Add this line to your crontab file (crontab -e
) to write the date and your public IPv4 address to a file called ip_public.txt
, saved in your home directory, every day at 12:00 AM.
0 0 * * * echo $(date +%Y-%m-%d) $(curl https://ipinfo.io/ip 2>/dev/null) >> ~/ip_public.txt 2>&1
add a comment |
Your Answer
StackExchange.ready(function()
var channelOptions =
tags: "".split(" "),
id: "106"
;
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function()
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled)
StackExchange.using("snippets", function()
createEditor();
);
else
createEditor();
);
function createEditor()
StackExchange.prepareEditor(
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: false,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: null,
bindNavPrevention: true,
postfix: "",
imageUploader:
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
,
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
);
);
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f277703%2fhow-to-track-my-public-ip-address-in-a-log-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
This one will give you your public IP, remove /ip
part to see more info.
$ curl ipinfo.io/ip
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
of course, it's not a full solution for you. But with it, you can write your own script, put that script incron
to make it get the IP and save into your log file.
– cuongnv23
Apr 21 '16 at 10:43
add a comment |
This one will give you your public IP, remove /ip
part to see more info.
$ curl ipinfo.io/ip
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
of course, it's not a full solution for you. But with it, you can write your own script, put that script incron
to make it get the IP and save into your log file.
– cuongnv23
Apr 21 '16 at 10:43
add a comment |
This one will give you your public IP, remove /ip
part to see more info.
$ curl ipinfo.io/ip
This one will give you your public IP, remove /ip
part to see more info.
$ curl ipinfo.io/ip
answered Apr 20 '16 at 4:15
cuongnv23cuongnv23
745
745
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
of course, it's not a full solution for you. But with it, you can write your own script, put that script incron
to make it get the IP and save into your log file.
– cuongnv23
Apr 21 '16 at 10:43
add a comment |
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
of course, it's not a full solution for you. But with it, you can write your own script, put that script incron
to make it get the IP and save into your log file.
– cuongnv23
Apr 21 '16 at 10:43
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
It doesn't show my IP history, though. @cuongnv
– overkill22
Apr 21 '16 at 2:25
of course, it's not a full solution for you. But with it, you can write your own script, put that script in
cron
to make it get the IP and save into your log file.– cuongnv23
Apr 21 '16 at 10:43
of course, it's not a full solution for you. But with it, you can write your own script, put that script in
cron
to make it get the IP and save into your log file.– cuongnv23
Apr 21 '16 at 10:43
add a comment |
You can try to use some dynamic dns services like noip.com
Then You can access resources by dns name, which will changing according to Your ip.
Generally, Your provider may NAT with pool of addresses. And every curl https://ipinfo.io/ip
request will return a random address from this pool, depends on the settings of the NAT.
It's better to use different methods to track visits to web-site. F.e. cookies.
Here is a small python code to put in cron and collect addresses:
#!/usr/bin/env python
from datetime import datetime
import os
import requests
LOG = '/tmp/ip.log'
URL = 'https://ipinfo.io/ip'
r = requests.get(URL)
if r.status_code == 200:
ip = r.content.decode('ascii').rstrip('n')
last_ip = None
if os.path.exists(LOG):
f = open(LOG, 'r')
last_ip = f.readlines()[-1].split()[-1]
f.close()
if ip != last_ip:
f = open(LOG, 'a')
f.write(" n".format(datetime.now(), ip))
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry fromxxx.xxx.xxx.xxx
with his IP address at that time?
– techraf
Apr 20 '16 at 8:32
add a comment |
You can try to use some dynamic dns services like noip.com
Then You can access resources by dns name, which will changing according to Your ip.
Generally, Your provider may NAT with pool of addresses. And every curl https://ipinfo.io/ip
request will return a random address from this pool, depends on the settings of the NAT.
It's better to use different methods to track visits to web-site. F.e. cookies.
Here is a small python code to put in cron and collect addresses:
#!/usr/bin/env python
from datetime import datetime
import os
import requests
LOG = '/tmp/ip.log'
URL = 'https://ipinfo.io/ip'
r = requests.get(URL)
if r.status_code == 200:
ip = r.content.decode('ascii').rstrip('n')
last_ip = None
if os.path.exists(LOG):
f = open(LOG, 'r')
last_ip = f.readlines()[-1].split()[-1]
f.close()
if ip != last_ip:
f = open(LOG, 'a')
f.write(" n".format(datetime.now(), ip))
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry fromxxx.xxx.xxx.xxx
with his IP address at that time?
– techraf
Apr 20 '16 at 8:32
add a comment |
You can try to use some dynamic dns services like noip.com
Then You can access resources by dns name, which will changing according to Your ip.
Generally, Your provider may NAT with pool of addresses. And every curl https://ipinfo.io/ip
request will return a random address from this pool, depends on the settings of the NAT.
It's better to use different methods to track visits to web-site. F.e. cookies.
Here is a small python code to put in cron and collect addresses:
#!/usr/bin/env python
from datetime import datetime
import os
import requests
LOG = '/tmp/ip.log'
URL = 'https://ipinfo.io/ip'
r = requests.get(URL)
if r.status_code == 200:
ip = r.content.decode('ascii').rstrip('n')
last_ip = None
if os.path.exists(LOG):
f = open(LOG, 'r')
last_ip = f.readlines()[-1].split()[-1]
f.close()
if ip != last_ip:
f = open(LOG, 'a')
f.write(" n".format(datetime.now(), ip))
You can try to use some dynamic dns services like noip.com
Then You can access resources by dns name, which will changing according to Your ip.
Generally, Your provider may NAT with pool of addresses. And every curl https://ipinfo.io/ip
request will return a random address from this pool, depends on the settings of the NAT.
It's better to use different methods to track visits to web-site. F.e. cookies.
Here is a small python code to put in cron and collect addresses:
#!/usr/bin/env python
from datetime import datetime
import os
import requests
LOG = '/tmp/ip.log'
URL = 'https://ipinfo.io/ip'
r = requests.get(URL)
if r.status_code == 200:
ip = r.content.decode('ascii').rstrip('n')
last_ip = None
if os.path.exists(LOG):
f = open(LOG, 'r')
last_ip = f.readlines()[-1].split()[-1]
f.close()
if ip != last_ip:
f = open(LOG, 'a')
f.write(" n".format(datetime.now(), ip))
edited Apr 2 at 8:51
answered Apr 20 '16 at 7:26
Alex BezpalkoAlex Bezpalko
112
112
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry fromxxx.xxx.xxx.xxx
with his IP address at that time?
– techraf
Apr 20 '16 at 8:32
add a comment |
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry fromxxx.xxx.xxx.xxx
with his IP address at that time?
– techraf
Apr 20 '16 at 8:32
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry from
xxx.xxx.xxx.xxx
with his IP address at that time?– techraf
Apr 20 '16 at 8:32
Any practical example of how a dynamic-DNS service would allow OP to correlate a two week-old log entry from
xxx.xxx.xxx.xxx
with his IP address at that time?– techraf
Apr 20 '16 at 8:32
add a comment |
Add this line to your crontab file (crontab -e
) to write the date and your public IPv4 address to a file called ip_public.txt
, saved in your home directory, every day at 12:00 AM.
0 0 * * * echo $(date +%Y-%m-%d) $(curl https://ipinfo.io/ip 2>/dev/null) >> ~/ip_public.txt 2>&1
add a comment |
Add this line to your crontab file (crontab -e
) to write the date and your public IPv4 address to a file called ip_public.txt
, saved in your home directory, every day at 12:00 AM.
0 0 * * * echo $(date +%Y-%m-%d) $(curl https://ipinfo.io/ip 2>/dev/null) >> ~/ip_public.txt 2>&1
add a comment |
Add this line to your crontab file (crontab -e
) to write the date and your public IPv4 address to a file called ip_public.txt
, saved in your home directory, every day at 12:00 AM.
0 0 * * * echo $(date +%Y-%m-%d) $(curl https://ipinfo.io/ip 2>/dev/null) >> ~/ip_public.txt 2>&1
Add this line to your crontab file (crontab -e
) to write the date and your public IPv4 address to a file called ip_public.txt
, saved in your home directory, every day at 12:00 AM.
0 0 * * * echo $(date +%Y-%m-%d) $(curl https://ipinfo.io/ip 2>/dev/null) >> ~/ip_public.txt 2>&1
answered Mar 16 at 12:37
NathanNathan
15515
15515
add a comment |
add a comment |
Thanks for contributing an answer to Unix & Linux Stack Exchange!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function ()
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f277703%2fhow-to-track-my-public-ip-address-in-a-log-file%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function ()
StackExchange.helpers.onClickDraftSave('#login-link');
);
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown