how to deal with daylight saving in hourly logs - logback

Am using logback xml to configure logging. I want the logs to be rolled over on an hourly basis. How would the behaviour be when daylight saving occurs?When the clock is advanced by an hour the logfile corresponding to that hour, does it get skipped?
When the clock is reverted by an hour, does the hourly file get overwritten?
What is the way to work around this?

Yes..as pointed put by #volodya and #Matt, logging in UTC format would be the ideal solution,

Related

Node-cron if node app restarts

So here is a thing, I have some lawyer app, and he needs to set reminder for some case, that reminder could be tomorrow, next week, next month idk. I was thinking about using node-cron, thing is i dont know what will happen when my app restarts, I assume it will crash all my reminders, and the second thing is how much will I load my server if i got to much reminders, OR do u have some other advice for this solution, maybe something with setInterval and run it every hour or something like that?
node-cron is used to run code as you would with normal cron, but in JS :)
So even if your code is crushed and restarted it will look at time set by you to execute some code and will not crush reminders.
For example if you run some code with cron condition 0 0 1 * *, which means every month on 1st date at 00:00.
That means that even if your app is crushed at 15th of month and restarted at 20th of month, it will run your job at 1st of next month at 00:00.
Between for automatically restarting your app you can use forever or pm2 packages from NPM
Now about this question.
how much will I load my server if i got to much reminders
I don't think it will load your server. node-cron internally uses setInterval, which is not CPU consuming, so go and run your crons without fear.

Point-In-TIme data restore on Amazon RDS

I have hosted my MySql database on Amazon RDS, and It has last automated snapshot. (e.g. yesterday midnight). Now situation is, I have deleted some of records from a very important table accidentally, and would like to recovery it. I have no additional backup since yesterday midnight. (as mention earlier). Now How should I recover data without taking any downtime?
How do I use point-in-time data recovery?
If someone need more information let me know and sorry for my poor explanation.
Point in time recovery allows you to create an additional RDS instance, based on the data as it existed on your instance at any specific point in time you choose between the oldest available automated backup and approximately 5 minutes ago. All you have to do is select what date and time you need.
There is no disruption or change to your running instance.
The process creates a new instance, which you connect to, collect the data you need in order to get your production system back the way it should be, and then destroy the new instance. Or, depending on what went wrong for you, you could also switch your application to this new instance and destroy the old one, though it seems unlikely that this is what you would want to do. But you can do either.
http://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/USER_PIT.html
I have no additional backup since yesterday midnight.
Point in time recovery doesn't care. RDS preserves the snapshots as well as a complete, timestamped log of everything that changed between the snapshots. These logs are archived in an area that is not accessible to you... but they are there. RDS will automatically load the most recent snapshot that is earlier than the point-in-time you select, and then use the logs to roll the new instance's data forward in time to the target time. When the process is complete, your new instance will contain exactly the data that was present on the old instance at the point in time that you selected.
lets assume I have one table contain 10 records at midnight. which is exists in backup/snapshot.
Stop thinking about what is in the snapshot. It doesn't matter.
Next day morning I have added 5 another records at 10:00pm. After half an hour (at 10:30) I have deleted 2 records from them antecedently.
Perform a point in time recovery, selecting any point between 10:00 and 10:30 -- a point in time when the records were in your database.
Point in time recovery creates a new instance, which contains all your data exactly as it existed at the time you selected. Connect to that new instance manually, fetch the missing rows, insert them back into your live/main/production database, and then the newly-created instance can be destroyed because it is no longer needed.
Do not assume this process is complicated or difficult.

mysql save date from different datetime locals

I'm having hard time to decide on the right approach for data saving from different time zones:
I'm building an application that supposed to serve users from all over the world.
I have a table named Events which saves events the users inserted.
In this table there are Start_Time and End_Time columns of the event, which I some time need to run a select query according to does columns, and in relevant to user's current time.
I'm thinking about what the best approach for saving does times in the database. obviously I have some lack of knowledge in the time zones field.
For now i'm saving all the times as current UTC time stamp, and i'm not sure that its the right way to do so.
can anyone please provide some guidelines or documents about to right way to store it ?
hey according to my understanding you have a application that send request to this database on behalf of user, and user has its own date and time zone.
I would recommend to change your request time zone on application level to UTC. bring your application and database to same page and then after processing you can convert it back to local time zone.
what application language your are using?

Mysql saving user's and server's current time difference

I have a web server which will be serving people from around the world.
The time is a really important matter in my application, since a lot of queries are taking the time in consideration.
I need a way to store user's and server's time differences.
For example:
User login to server and send its current time.
Server's save the current time difference in mySql server
Every every time the server needs to use user's time in a query he knows how to calculate it since
it knows the difference..
What i really need is the server's ability to calculate user's time according to server's own time.
I've read about using UTC time but i didn't really understand how to implement it...
Let's say you are in the US and i am in the UK. If we both check the UTC time at the same time (with whatever code/method) we should see the same result. Check out the different ways of getting UTC timestamps in milliseconds. Then, in theory, if you sync everything by UTC time (including the server) you don't really need to be aware of timezone offsets because these offsets are only relevant if you consider the server time is based on its local timezone.
In MySQL you can get a unix timestamp with UNIX_TIMESTAMP(). As far as i know it has granularity to the second, not millisecond (so you will get the number of seconds since 1970). You can also check out UTC_TIME() and UTC_TIMESTAMP().

Mysql timestamp: output UTC time instead of local server time?

I'm creating software where I have to present time based on user's local time. The users can come from all over the world.
From what I've been reading Mysql stores timestamps in UTC and then convert it to the server timezone.
Is there anyway I can output the timestamp in the original UTC time instead of having it being automatically convert to server's local time?
I would like to do this without having to mess around with mysql's timezone settings since my software will be used in shared hosts and I don't know If I have control over those settings.
See
https://stackoverflow.com/a/12290486/110933
SELECT UNIX_TIMESTAMP(<your_datetime_col>)...