Change web server log timestamp to SQLServer timestamp

The format of a log entry in Apache web log is
[10/Oct/2000:13:55:36 -0700]
Is there a more elegant way to convert this string into an SQL Server datetime than this:
declare @ts char(28);
set @ts = '[10/Oct/2000:13:55:36 -0700]';
select dateadd(hour,
convert(int, substring(@ts,22,3)),
convert(datetime2(0),
substring(@ts,2,11)+' '+
substring(@ts,14,8)+':000',
113) ) ;

Hi LauriP,
If all the timestamps are in that fixed format, the most elegant way is to  concatenate the known length datepart and timepart and cast the concatenated string to a DATE type.
declare @ts char(28);
set @ts = '[10/Oct/2000:13:55:36 -0700]';
SELECT CAST(SUBSTRING(@ts,2,11)+' '+SUBSTRING(@ts,14,8) AS DATETIME2(0))--OR
SELECT CAST(SUBSTRING(@ts,2,CHARINDEX(':',@ts)-2)+' '+SUBSTRING(@ts,CHARINDEX(':',@ts)+1,8) AS DATETIME2(0))
If you have any question, feel free to let me know.
Eric Zhang
TechNet Community Support

Similar Messages

  • Cannot view web server logs in Server Admin

    It has been a terrible day.
    First, the interesting part:
    I woke up to find that 25 sites that are hosted on an XServe G5 running OS X Server 10.3.9 had been defaced. As the part-time, unpaid admin of this server, it was my responsibility to track down the vulnerability in the system and restore the defaced files from backups. The hacker had replaced the index.html file for each of the sites with his own, special version, in which he proudly declared that my server had been owned. I did a Nessus scan of the server and came up with nothing. I pulled what was left of my hair out looking for every vulnerability I could come up with, and still nothing.
    I then decided to use Google to get more information about him, using the name he proudly posted on the defaced sites, and was able to get his IM address. I proceeded to have an awkwardly pleasant conversation with him, in which he declared that he has discovered a new vulnerability and decided to try it out on my machine for the challenge. He apologized, but would not reveal the vulnerability (although he hinted that it had something to do with mod_security). He also promised to leave my machine alone now ....
    (Now for the not so interesting part, and the nature of my current problem)
    Anyway, I did what I could to clean up the mess, and wound up viewing the access logs in the Console app via ARD. That led me nowhere, so I decided to call it a night and logged out of ARD. A few minutes later, I thought I would log into ServerAdmin and take another look at those logs, but alas, they could no longer be viewed through ServerAdmin! The log section is empty. I ssh'd into the machine to see if he had broken his promise and messed around some more, but the logs still existed where they had always been. I ran tail -f on them to make sure they are still being updated, and they are.
    So after all that, it seems my big problem at the moment is viewing logs in ServerAdmin. I did not make any changes to httpd.conf (outside of disabling mod_security, which commented out the appropriate LoadModule and AddModule lines). I also disabled a few other unnecessary mods earlier in the evening via ServerAdmin, but I doubt that any particular mod controls whether or not I can view log files in ServerAdmin.
    I apologize for the length of this post, but it has been quite a day. If anyone can provide any clues as to either the location of error logs for the ServerAdmin app or any sort of known resolution to this issue, I would name my first born after you.
    Thanks.
    XServe G5   Mac OS X (10.3.9)  

    skvaish1 wrote:
    What purpose you will solve by loading the web server logs into the database? I will not advice it. It will be much easier for you to manage these logs at file system level as well monitor these for any issues, rather than loading it into database and then running sone database job to dig into those logs for any errors. Loading logs into database will help if you need to keep them for long time (More than 1 Year time frame or for regulatory purpose), otherwise it is better for logs to keep it on file system and just get regular backups of these logs into tape.
    My 2 cents
    RegardsOverall, I agree but I don't understand your comment about "Loading logs into database will help if you need to keep them for long time". Even if needed for regulatory reasons, one can manage them quite nicely outside of the database.
    Also to expand on this a bit for the OP .... if the need arose to use SQL to mine the logs for information that would be hard to get using the search feature of a simple text editor, one could always define an external table on an as-needed basis.

  • How to change web server from inbuilt Tomcat to IIS in already configured Cold Fusion 10

    how to change web server from inbuilt Tomcat to IIS in already configured Cold Fusion 10

    You just need to run the Web Server Configuration Tool to connect ColdFusion to IIS.  It can be found in the ColdFusion program group off of the Start menu.  Be sure to run it "As Administrator".
    -Carl V.

  • Sun Web server 6.1 SP9 Reverse proxy - Changing Web Server Context

    I am trying to configure a Reverse Proxy such that it can change the context of the requested URL.
    My SOWS reverse proxy plug-in is running on server server1.sample.com and the destination server is running on server2.sample.com. The use case, the incoming URL is [|http://server1.sample.com/dummy1/]...... and I need to map this to {color:#0000ff}http://server2.sample.com/*dummy2*/.....;{color} It looks like the reverse proxy only maps to a server level but disregards the context. The reason I say that, in the server 2 logs I see - .... trying to GET /dummy1....; I needed the call to look for dummy2 context. Can this be done?

    well, web server uri processing does not understand web application level context (in terms of java web applications). however, if you would like to map all uri's ending with /dummy1 to go to /dummy2, then you can easily do this with web server 7 regular express processing
    http://blogs.sun.com/elving/entry/mass_virtual_hosting_in_7
    http://docs.sun.com/app/docs/doc/820-6599/gdaer?a=view
    besides web server 7 includes a very tightly integrated reverse proxy unlike 6.1 where you need reverse proxy as a separate plugin. so, you might want to check out if ws7 can serve your needs
    - sriram

  • Web server log files under LabVIEW RT

    Hello,
    Is there any log files for the web server under LabVIEW RT running on a PXI?  The log file checkbox is disable in the target options.
    Also, is there a way to find out if the web server is running on the target?
    I'm asking the question because I can't access anymore a remote panel (and even the root of the web server) on my PXI.  I reinstall everything and I still have the issue.  I'm pretty sure that IT changes some network settings but they say no.  I need to validate that everything is working on my side before before taking further action.
    Thanks,
    Patrick

    Hi Patrick, 
    I would suggest having the log file checkbox enabled in the target options.  That should show if errors are occurring while it is running. Are you running remote front panels and web services, or just remote front panels?
    Can you provide a picture of all the software you have installed on your PXI?  You should be able to find this in MAX under the PXI in Remote Systems.
    Scott A
    SSP Product Manager
    National Instruments

  • Web server logging

    In Labview 8.6 real-time projects, when i go to "Web server: configuration" page of target properties, the "Use log file" checkbox is grayed and unselectable. But it wasn't with Labview 8.2 on same target. Why can't i enable logging? Everything else is working fine

    In 8.6 a new, third party, web server was included in LabVIEW in place of the old internal web server. As we were selecting the features to include in our build of the new web server, we decided that including logging by default on RT targets would be a bad idea because it would consume valuable disc space and the user may not know why.
    This was a mistake and will be fixed in a future version of LabVIEW.

  • Published Flash module and 404 errors in the web server log

    I’ve created a Presenter module, published it to my computer, and uploaded all the files to a web server. And it plays fine via the web.
    The odd thing is a bunch of 404 errors in the web log:
    10.1.2.104 - - [29/Jul/2009:10:36:00 -0700] "GET /repository/university/courses/3/flash/data/spk10821.1.jpg HTTP/1.1" 404 255 "-" 1166 419
    10.1.2.104 - - [29/Jul/2009:10:36:29 -0700] "GET /repository/university/courses/3/flash/data/spk10821.1.jpg HTTP/1.1" 404 255 "-" 1166 419
    10.1.2.104 - - [29/Jul/2009:10:36:57 -0700] "GET /repository/university/courses/3/flash/data/spk10821.1.jpg HTTP/1.1" 404 255 "-" 1166 419
    In the data directory there is a file named spk10821.jpg that was generated by Presenter. The image is actually the presenter bio photo that would normally show up in the sidebar -- but no photo is there. The browser never requests the valid spk10821.jpg file, only the non-existent spk10821.1.jpg path.
    Anybody know why this would be happening? I see in data/viewer.xml there is a tag for <image>spk10821.1.jpg</image> but I don’t know why Presenter would mention that file in the XML but generate a differently-named one in the publish folder.
    I’m wondering if I should have the web server rewrite requests with the ".1.jpg" ending to get rid of the ".1" part so they will work.
    By the way, this is with PowerPoint 2003 SP3 and Presenter 7.0.1.

    Hi Daniel,
    I am assuming that you are using Visual Studio 2010 to target the .Net framework 4.0
    Crystal Reports 2008 is not compatible with VS 2010. Use [Crystal Reports for Visual Studio 2010|Crystal Reports for Visual Studio 2010 Production Release Now AvailableCystlR%2528SAPWeblogs%253ACrystal+Reports%2529] to target .Net framework 4.0.
    Deploy the application using the methods specified in the 'Deployment' section of the [CR for VS 2010 .Net SDK developer guide|http://help.sap.com/businessobject/product_guides/sapCRVS2010/en/crnet_dg_2010_en.zip].
    See if you can reproduce the issue after redeploying the application as mentioned above.
    Few questions-
    - Is it the dev machine or production machine causing the issue?
    - OS version?
    - What does the application do? i.e. view, export, print report?
    - Issue is with some reports or all the reports.
    See if there is an image on the report, remove the image and add it as a picture object ' Insert --> Picture' from the CR designer.
    Hope this helps,
    Bhushan.

  • Web server log not show byte transfer for php

    I added php module to iWS 6.0 it work fine but access log not show byte transfer information for php. How can I do?

    The iPlanet Web Server 6.0 access log does not report the number of bytes sent by plugins unless the plugin explicitly sets the Content-length: header. Sun ONE Web Server 6.1 is the first version of Web Server that always reports the number of bytes sent, even if the plugin neglects to set a Content-length: header.

  • Change BI server  log directory location

    We have very less space on our Bi server/log disk and nqsserver generating core dumps of size >6g causing the disk to fill up. due to incomplete core files there are of no use to analyze. This is what support says.
    so ...
    Q:
    How can I change the BI/server/log to some where else? some other disk mount point.
    or can I have only the core files go to other/different disk?

    I think I figured it out...the startup script gives the clue..
    Thanks .

  • Disabling logging of HEAD request in HTTP web server logs

    Hi,
    I would like to stop the logging of HEAD requests in my HTTP server logs. I was thinking of using the Rewrite rule, however, there may be a more direct way of doing this. Is there a configuration setting within HTTP Server to do this?
    I'm using WebTier component of Weblogic 10.3.2.
    Thanks,

    I found the solution to disable HEAD requests.
    Edited by: WallyP on Mar 11, 2010 12:24 PM

  • OS X Web Server log

    Hello,
    I would like to install mod_jk (1.2.40) on OS X Server (10.10.2), Server(4.0.3)
    I compiled mod_jk succesfully
    After I add configure for mod_jk
    LoadModule jk_module libexec/apache2/mod_jk.so
    JkWorkersFile /private/etc/apache2/workers.properties
    JkShmFile /var/log/apache2/mod_jk.shm
    JkLogFile /var/log/apache2/mod_jk.log
    JkLogLevel debug
    JkMount /project/* router
    and apache restart
    But the apache didn't start.
    Also I cound not find any message in /var/log/apache2/error_log file.
    Is there any one sucessfully installed the mod_jk on OS X Server ?
    Thanks,
    Youngho

    Apple use non-standard files and locations to store the Apache2 settings if you have Server.app installed. The main equivalent to the standard httpd.conf file is instead stored as -
    /Library/Server/Web/Config/apache2/httpd_server_app.conf
    This file contains a list of which Apache2 modules to load and where they should be loaded from. The standard location for modules is /usr/libexec/apache2 but the standard modules use a relative path of just libexec/apache2/ if you want to add your own modules I suggest you use a full path e.g. /usr/local/mymodule

  • Obtain source IPs in Web Server logs

    Hi,
    We have inherited a site which is running SAM 6.3 Q1. Access to SAM is always through a VIP which uses a NAT pool. There is a specific technical reason for this but since we don't own the network it is not a discussion I want to get into yet.
    So, no matter which client originates a request we cannot see the source IP as it is NAT'ed to one of a small range of IP addresses, while passing through the VIP. Since the Policy Agents always use the same URL we are unable to determine which requests originate from which clients.
    Any way to increase logging in the Web Servers in order to obtain source IP addresses or something similar?
    Thanks,
    Eddie T

    quad3d@work wrote:My work uses BB and Cacti, both works well!
    Thanks. What is BB?
    I need a SSH and Apache/WWW Monitoring not very difficult to setup and config.
    I want to have the failed attempts (SSH) and Ips that connected to my httpd.
    Thank you and for the other solutions. I will check them and I will decide
    Last edited by k3rn31 (2008-03-06 07:50:38)

  • Need Help - IIS Web Server Log Files

    Hi - We run a java applet on our web site and it runs fine. The problem is that in our log files we get hammered with this 404 error all the time.
    Can't find ConsultScrollBeanInfo.class
    The software maker says it is a bug with Java 2 SDK.
    If this is true, is there a fix so that IIS log files wont pick this up any more?
    Thanks!

    Hi Patrick, 
    I would suggest having the log file checkbox enabled in the target options.  That should show if errors are occurring while it is running. Are you running remote front panels and web services, or just remote front panels?
    Can you provide a picture of all the software you have installed on your PXI?  You should be able to find this in MAX under the PXI in Remote Systems.
    Scott A
    SSP Product Manager
    National Instruments

  • Changing web server refresh to less than one second

    I just set up another PC on our network to display our engine test VI.  Is there any way to increase the refresh rate to less than one second.  I tried entering .5 sec on the config screen, but it changed back to one second.  I'm using LabVIEW 8.5.1.
    Thanks,
    Todd Munsell
    Wood Group Pratt & Whitney Industrial Turbine Services
    Todd Munsell
    Turbine Engine Test Technician/IT Tech
    Wood Group Pratt & Whitney Industrial Turbine Services, LLC
    Plattsburgh, NY

    Thanks again.  I'll try that.
    BTW, I just spoke with out rep from Daytronic Corp. who was testing the comm cards with his System 10 and PC.  They worked fine for him.  The only difference is that he is using LabVIEW 7.0 and we are using 8.5.1.  They don't have any subVIs written for the newer LV versions.  That may be the cause the the issue we're having with using the comm cards to access the DAQ.  They do not have the time or money to update their subVIs for the newer LV versions, but I'd have to think that there is a way to change them myself to make them work.  Ideally, I want to use a modified version of the app I'm using on another PC without having to bother with the network to pass the data.  I already have a cable made to connect the other PC to the System 10.
    I almost forgot something.... I found a version 8 System 10 subVI package using the NI search, but it didn't work either.
    Do you know what might have changed in the newer LV versions that could cause this issue?  I've attached a zip file of their subVIs.  Like I mentioned earlier, LV works fine using the main (built-in) comm port on the System 10 DAQ.  It's just the additional cards that do not work correctly.  They seem to establish the comm link OK, but the binary data that the System 10 sends is not interpreted and displayed correctly.  It's usually all gibberish on the screen.
    Of the Daytronic subVIs, the subVI that I use to test with is the "example.vi", which is used for binary data.
    The "simple terminal" subVI works fine, but I can't use it to test the data link since it's configured differently.
    When I use the main System 10 comm port, the simple terminal doens't work and the example.vi does.  Why wouldn't it work with the other ports/cards?
    Could you please check these out when you have the time and see if you can find something that isn't configured correctly?  I may be overlooking something obvious, since I'm still learning LV.
    Thanks
    Message Edited by tmunsell on 07-28-2008 09:18 PM
    Todd Munsell
    Turbine Engine Test Technician/IT Tech
    Wood Group Pratt & Whitney Industrial Turbine Services, LLC
    Plattsburgh, NY
    Attachments:
    labvdr7.zip ‏891 KB

  • Change Domain name in Hyperion Financial Reporting Web Server

    I have System 9.3.1 and i need to change the Domain name from one to another for the web application.
    Under which location i can find the domain controller defined??
    All the web applications are controlled by Websphere.

    in version 11.1.2
    we can changes web server name at
    oracleHOME/user_projects/epmsystem1/httpConfig/ohs/config/OHS/ohs_component
    and file name is mod_wl_ohs.conf
    is that something you are looking for

Maybe you are looking for