<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: Trying to split the message text in a Windows event log in Splunk Search</title>
    <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83269#M21185</link>
    <description>&lt;P&gt;Excellent! I'm glad to hear it works. And yeah -- Splunk really is awesome. Looking at printer logs (which I'd been sending to Splunk for about a year, but was totally unaware of) and all of a sudden being able to create interesting and useful reports was easy and awesome.&lt;/P&gt;</description>
    <pubDate>Fri, 05 Nov 2010 07:52:12 GMT</pubDate>
    <dc:creator>David</dc:creator>
    <dc:date>2010-11-05T07:52:12Z</dc:date>
    <item>
      <title>Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83265#M21181</link>
      <description>&lt;P&gt;We are collecting Windows 2008R2 Printer server logs and have identified event_id = 307 as the log that contains information about printed jobs.  The Message however, has the rest of the information in it that we want to be able to report on.  Namely we want to be able to generate reports with Printer, pages Printed, User, machine.  User is easy since that is outside of the log.  The others are a bit more difficult.  The tactic we are using is to replace via regex those strings we don't want thusly:&lt;/P&gt;

&lt;P&gt;source="WinEventLog:Microsoft-Windows-PrintService/Operational" EventCode="307" Message=* | eval Machine=replace(Message, “^.&lt;EM&gt;?on (.&lt;/EM&gt;?) was printed.&lt;EM&gt;?”, “\1”) | eval Printer=replace(Message, “^.&lt;/EM&gt;?printed on (.&lt;EM&gt;?) through port.&lt;/EM&gt;?”, “\1”) | eval Pages=replace(Message, “^.&lt;EM&gt;?Pages printed: (.&lt;/EM&gt;?). No.*?”, “\1”) | table Machine, Printer, Pages, User&lt;/P&gt;

&lt;P&gt;That fails out with this error:
SearchException: Error in 'eval' command: The expression is malformed. An unexpected character is reached at '“^.&lt;EM&gt;?on (.&lt;/EM&gt;?) was printed.*?”, “\1”)'.&lt;/P&gt;

&lt;P&gt;The Message data itself looks like this:&lt;/P&gt;

&lt;P&gt;Message="Document 140, Microsoft Word - Document001 owned by personA on Machone001 was printed on HP_Printer001 through port 123.123.123.123.  Size in bytes: 1219223. Pages printed: 27. No user action is required."&lt;/P&gt;

&lt;P&gt;And we want to isolate three values…&lt;/P&gt;

&lt;P&gt;The characters after "Pages Printed:" and up to the ".".  In other words the number of pages printed.&lt;/P&gt;

&lt;P&gt;Then the same with the string before "through port" so that we know the printer name&lt;/P&gt;

&lt;P&gt;Then the string before "was printed"  which gives us the name of the machine that originated the print job.&lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2010 03:38:25 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83265#M21181</guid>
      <dc:creator>ssemone</dc:creator>
      <dc:date>2010-11-04T03:38:25Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83266#M21182</link>
      <description>&lt;P&gt;Try this: &lt;/P&gt;

&lt;P&gt;&lt;CODE&gt;source="WinEventLog:Microsoft-Windows-PrintService/Operational" EventCode="307" | rex field=_raw "owned by (?&amp;lt;User&amp;gt;.*?) on (?&amp;lt;Machine&amp;gt;.*?) was printed on (?&amp;lt;Printer&amp;gt;.*?) through port .* Pages printed: (?&amp;lt;Pages&amp;gt;\d*)" | table Machine Printer Pages User&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;You can also toss the regular expressions in your local props.conf:&lt;BR /&gt;
&lt;CODE&gt;[WinEventLog:Microsoft-Windows-PrintService/Operational]&lt;/CODE&gt;&lt;BR /&gt;&lt;CODE&gt;
EXTRACT-Printer = owned by (?&amp;lt;User&amp;gt;.*?) on (?&amp;lt;Machine&amp;gt;.*?) was printed on (?&amp;lt;Printer&amp;gt;.*?) through port .* Pages printed: (?&amp;lt;Pages&amp;gt;\d*)&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;And then your query would just become: &lt;BR /&gt;
&lt;CODE&gt;source="WinEventLog:Microsoft-Windows-PrintService/Operational" EventCode="307" | table Machine Printer Pages User&lt;/CODE&gt;&lt;/P&gt;

&lt;P&gt;The sourcetype for the props.conf may be off -- I haven't made the jump to LWF yet -- but it should get you close. &lt;/P&gt;</description>
      <pubDate>Thu, 04 Nov 2010 06:50:04 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83266#M21182</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2010-11-04T06:50:04Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83267#M21183</link>
      <description>&lt;P&gt;If you want to be more generic, you can always treat these as independent entries.&lt;/P&gt;

&lt;P&gt;Technically this is less efficient, but probably not enough to be noticeable.&lt;/P&gt;

&lt;P&gt;In transforms.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[winprint-user]
REGEX = owned by (\S+)
FORMAT = user::$1

[winprint-pages]
REGEX = Pages printed: (\d+)
FORMAT = pages::$1

[winprint-machine]
REGEX = was printed on (\S+)
FORMAT = machine::$1
&lt;/CODE&gt;&lt;/PRE&gt;

&lt;P&gt;In props.conf:&lt;/P&gt;

&lt;PRE&gt;&lt;CODE&gt;[WinEventLog:Microsoft-Windows-PrintService/Operational]
REPORT-printing = winprint-user,winprint-pages,winprint-machine
&lt;/CODE&gt;&lt;/PRE&gt;</description>
      <pubDate>Thu, 04 Nov 2010 07:13:39 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83267#M21183</guid>
      <dc:creator>southeringtonp</dc:creator>
      <dc:date>2010-11-04T07:13:39Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83268#M21184</link>
      <description>&lt;P&gt;This did it, thanks.  We'll test out doing this via props.conf as well.  Splunk is awesome.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2010 06:06:38 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83268#M21184</guid>
      <dc:creator>ssemone</dc:creator>
      <dc:date>2010-11-05T06:06:38Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83269#M21185</link>
      <description>&lt;P&gt;Excellent! I'm glad to hear it works. And yeah -- Splunk really is awesome. Looking at printer logs (which I'd been sending to Splunk for about a year, but was totally unaware of) and all of a sudden being able to create interesting and useful reports was easy and awesome.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2010 07:52:12 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83269#M21185</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2010-11-05T07:52:12Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83270#M21186</link>
      <description>&lt;P&gt;As an aside, here is the report I most enjoy:&lt;BR /&gt;
&lt;CODE&gt;[PrinterQuery| stats sum(Pages) as TotalPages by UserName | sort limit=10 -TotalPages | fields - TotalPages] PrinterQuery | chart sum(Pages) by User,Printer&lt;/CODE&gt;&lt;BR /&gt;
The first part is a subquery that will generate a list of the top 10 users. The second part will put a chart of their printing habits. With the two combined, you can generate a stacked bar graph on a dashboard that will constantly show you the activities of your top printers.&lt;/P&gt;</description>
      <pubDate>Fri, 05 Nov 2010 07:55:45 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/83270#M21186</guid>
      <dc:creator>David</dc:creator>
      <dc:date>2010-11-05T07:55:45Z</dc:date>
    </item>
    <item>
      <title>Re: Trying to split the message text in a Windows event log</title>
      <link>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/633082#M219915</link>
      <description>&lt;P&gt;13 years later and this solution worked like a charm for me. Although, I wasn't able to use the props.conf file. Not sure if that's changed since this topic came up.&lt;/P&gt;</description>
      <pubDate>Fri, 03 Mar 2023 00:11:36 GMT</pubDate>
      <guid>https://community.splunk.com/t5/Splunk-Search/Trying-to-split-the-message-text-in-a-Windows-event-log/m-p/633082#M219915</guid>
      <dc:creator>dionrivera</dc:creator>
      <dc:date>2023-03-03T00:11:36Z</dc:date>
    </item>
  </channel>
</rss>

