macOS srtftime date format in goaccess - date

I have a nginx log file where lines being with:
192.168.1.254 - - [05/Feb/2023:13:35:36 +0100] # followed by request, response, user-agent etc.
In the goaccess.conf file, I have this:
date-format %d/%b/%Y
time-format %H:%M:%S %z
log-format %h - - [%d:%t] "%r" %s %b "%R" "%u"
When I run goaccess on the file, I get:
Token '05/Feb/2023' doesn't match specifier '%d'
For the life of my I can't figure out why 05/Feb/2023 doesn't match %d/%b/%Y, especially considering that if I run date +"%d/%b/%Y" I get 05/Feb/2023.
According to the developer, this is an isolated case with my machine, which is running macOS 12.6.2 on Intel. But what could be causing it?
Thanks for your help.

Related

z/OS Unix System Services BPXBATCH ends with CC=3840

My BPXBATCH step is failing and I can't find the specific RC/RSNC described in M&C. For what it's worth, I had the JCL in an HFS dataset and ran USS's submit command.
Can anyone tell me what I did wrong?
Another clue:
My z/OS system will not allow me to sign into my ID in OMVS (3270 mode through ISPF panels), and simultaneously log in to my id in USS's SSH shell. It gives a resource busy error. The sysadmin claims this is not supported, but I suspect it could be made to be supported.
I've tried to find info on messages and codes, but did not see anything for this specific error.
COPYHFS Step
//COPYHFS EXEC PGM=BPXBATCH
//STDERR DD SYSOUT=*
//STDOUT DD SYSOUT=*
//STDPARM DD *
SH cp
-P "RECFM=FB,LRECL=287,BLKSIZE=6027,SPACE=(TRACK,(1,1))"
/u/woodsmn/SSC.D051721.T200335.S90.CP037
//\'WOODSMN.SSC.D051721.T200335.S90.CP037\'
/*
STDERR DD
FSUM1004 Cannot change to directory </u/woodsmn>
IEF142I WOODSMNX COPYHFS - STEP WAS EXECUTED - COND CODE 3840 (edited)
I cannot see why you got FSUM1004 Cannot change to directory </u/woodsmn>, since you wrote you can change to directoy /u/woodsmn. So I thought I'd try to reproduce your error, but got different one:
cp: FSUM6258 cannot open file "//'Z10411.SSC.D051721.T200335.S90.CP037'": EDC5121I Invalid argument.
After I changed SPACE=(TRACK,(1,1))to SPACE=(TRK,(1,1)) the job completed without error.
The job did run under your userid WOODSMN, didn't it?

Get date of last saturday - BusyBox 1.1.0

Since the date in BusyBox is not as powerful as gnu date, I have problems to calculate the date of last saturday.
last_sat=`date +"%Y-%m-%d" -d "last saturday"`
only works fine with gnu date.
I've found something like this to calculate from Epoch
busybox date -D '%s' -d "$(( `busybox date +%s`+3*60 ))"
but my BusyBox (v1.1.0) doesn't recognize the -D argument.
Any suggestions?
For the last Saturday before today, under busybox 1.16:
date -d "UTC 1970-01-01 $(date +"%s - 86400 - %w * 86400"|xargs expr) secs"
How it works: take the current date in seconds, subtract one day, subtract one day times the number of the current weekday, then convert those seconds back to a date.
EDIT: after hacking together a build of 1.1, this works:
date -d "1970.01.01-00:00:$(date +"%s - 86400 - %w * 86400"|xargs expr)"
This working version is based on code-reading:
} else if (t = *tm_time, sscanf(t_string, "%d.%d.%d-%d:%d:%d", &t.tm_year,
&t.tm_mon, &t.tm_mday,
&t.tm_hour, &t.tm_min,
&t.tm_sec) == 6) {
t.tm_year -= 1900; /* Adjust years */
t.tm_mon -= 1; /* Adjust dates from 1-12 to 0-11 */
BusyBox's date command has been the topic of some discussion over the years. Apparently it doesn't always work as documented, and it doesn't always work the same as previous versions.
On a BB system I administer running BusyBox v1.01, I'm able to use the -d option with dates in the format MMDDhhmmYYYY.ss, and in no other format that I've tried. Luckily, output formats work as expected, presumably because date is using a proper strftime() according to comments in the source.
Here's my forward-and-reverse example:
[~] # busybox date '+%m%d%H%M%Y.%S'
090500152016.41
[~] # busybox date -d 090500152016.41
Mon Sep 5 00:15:41 EDT 2016
So .. what can we do with this? It seems that we can't do an arbitrary adjustment of seconds, as it only reads the first two digits:
[~] # busybox date -d 123119001969.65 '+%s'
65
[~] # busybox date -d 123119001969.100 '+%s'
10
Well, it turns out you can load the date fields with "invalid" numbers.
[~] # busybox date 090100002016
Thu Sep 1 00:00:00 EDT 2016
[~] # busybox date 093400002016
Wed Oct 4 00:00:00 EDT 2016
[~] # busybox date 09-200002016
Mon Aug 29 00:00:00 EDT 2016
So let's adjust the "day" field using something based on %w.
today=$(busybox date '+%m%d%H%M%Y')
last_sat=$(busybox date -d "${today:0:2}$( printf '%02d' $(( 10#${today:2:2} - 1 - $(busybox date '+%w') )) )${today:4}" '+%F')
This simply subtracts numbers in the second field (the 3rd and 4th characters of the date string). It obviously requires that your shell either be bash or understand bash-style math notation ($((...))). Math-wise, it should work as long as "last saturday" is within the same month, and it MAY work (I haven't tested it) with rollvers to the previous month (per the last test above).
Rather than jumping through these burning hoops, I recommend you just install a GNU date binary, and don't use busybox for this one binary. :-P
Good luck!

Setting Date format for autoprop 'DATE' in SVN

I have some files that use the autoproperty $Date of SVN.
When some colleagues in France do a checkout of the repository, the date is in French. When they do the verification of checksum, these files are KO because of this difference of format for the date.
Note: we are using Windows and our client of choice is TortoiseSVN but are open to use command line clients.
Question 1: Is there any way to force the format for the date during the checkout?
We tried the following:
Setting "English" in Tortoise SVN
Setting environment variable LANG to EN_US and doing a checkout with both TortoiseSVN and svn commandline
None of these solutions is working.
Question 2: Would the time zone impact the date in the header as well?
Thanks
NB: This is the header of our source code, for what it matters.
/*==============================================================================================
* FILENAME : Source.h
* VERSION : $Revision: 85911 $
* MODIFICATION DATE : $Date: 2015-06-12 18:26:22 +0800 (Fri, 12 Jun 2015) $
*============================================================================================*/
A1: I don't know, how to manipulate locale-setting in Windows in easy and automated style - inspired by this old answer in Subversion maillist - (better to ask it SU) and can suggest now only dirty hack: import reg-files for FR and EN locales before and after checkout (how to prepare: switch to FR in Control Panel, save Current Control Set part of registry, return to EN, save CCS again, leave in .reg only mutable part), checkout in bat-file only (change locale around checkout)
A2: Sad, but yes
$Date: 2015-06-19 19:45:22 +0500 (Пт, 19 июн 2015) $
inserts not only language-specific date (trailing part), but also TZ of client
1.8.*-specific solution: you can create and use replacement for $Date keyword, which use UTC-time instead of local (as $Id do for time-part now) with %d variable it it
>svn pl -v file.txt
Properties on 'file.txt':
svn:keywords
Author Date Id Revision URL Header IntDate=%d
and IntDate will expand location-independent
$IntDate: 2015-06-19 14:45:22Z $

How to use special characters in password for mule endpoint

Im trying to access an outbound-endpoint sending login password for it, but the password have a # character, so ive tryed encode it to %23 and even so im getting an error message...
How can i can send it?
My code:
<http:outbound-endpoint host="localhost" path="path/path" port="8080" user="username" password="paswd%23" exchange-pattern="request-response" doc:name="HTTP">
</http:outbound-endpoint>
And the error is:
Invalid uri 'http://username:paswd##localhost:8080/path/path
Mule version 3.4
Need to encode. As #daviddessot mentioned. That's right.
As a extention:
Feel free to use: http://www.url-encode-decode.com/
Major chars:
! - %21
$ - %24
% - %25
# - %40
Double encode the password:
password="paswd%2523"

perl DateTime incorrect timezone offset

I have several servers running under centos 6.3 and I faced issue that perl module DateTime treats Europe/Moscow timezone as UTC+3
[ulan#rt-virtual ~]$ perl -MDateTime -e 'print DateTime->now()->set_time_zone("Europe/Moscow"), "\n";'
2013-12-19T11:11:38
but in fact it is UTC+4 and system tools like zdump or date work correctly
[ulan#rt-virtual ~]$ zdump Europe/Moscow
Europe/Moscow Thu Dec 19 12:11:47 2013 MSK
I updated tzdata and DateTime module but it didn't help.
How can I amend this?
Thanks.
Well, DateTime module is doing its magic by following the rules specified in the TimeZone modules specific for each timezone. For Europe/Moscow, the module's is DateTime::TimeZone::Europe::Moscow. The problem is all the files are generated automatically corresponding to the rules existing when a specific version of DateTime module is released.
In this case one very important change - Russia's stopping following DST routines in 2011 - wasn't obviously reflected in that file. So updating - either the whole module or only the relevant TimeZone part - should have fixed the issue.
You can use your systems tzfile(5), using DateTime::TimeZone::Tzfile. Not only does it perform better than DateTime::TimeZone it also removes the need to have redundant data that needs to be in sync.
$tz = DateTime::TimeZone::Tzfile->new('/etc/localtime');
$dt = DateTime->now(time_zone => $tz);